一、创建一个空GameObject和脚本GizmosTest.cs
using UnityEngine; using System.Collections; [ExecuteInEditMode]//让脚本在编辑模式下运行 public class GizmosTest : MonoBehaviour { Transform mTran; void Start() { mTran = transform; } void OnDrawGizmos() { Gizmos.color = Color.yellow; Gizmos.DrawWireCube(mTran.position, new Vector3(1, 1, 1)); } }
Scene窗口中的效果