using System.Collections; using System.Collections.Generic; using UnityEngine; public class Test : MonoBehaviour { public Color borderColor = Color.yellow; public float borderWidth = 5f; private void OnDrawGizmos() { RectTransform rt = GetComponent(); if (rt != null) { Gizmos.color = borderColor; Gizmos.DrawWireCube(rt.position, rt.sizeDelta + new Vector2(borderWidth * 2, borderWidth * 2)); } } // Update is called once per frame void Update() { } }