center | Position of the cube. |
size | Size of the cube. |
Draw a wireframe box with center
and size
.
To use this example, save this script in the Assets/Editor folder:
#pragma strict @CustomEditor(DrawWireCube) public class DrawWireCubeEditor extends Editor { function OnSceneGUI() { var t: DrawWireCube = target as DrawWireCube; Handles.color = Color.yellow; Handles.DrawWireCube(t.transform.position, t.size); } }
using UnityEngine; using UnityEditor;
[CustomEditor( typeof( DrawWireCube ) )] public class DrawWireCubeEditor : Editor { void OnSceneGUI( ) { DrawWireCube t = target as DrawWireCube;
Handles.color = Color.yellow; Handles.DrawWireCube( t.transform.position, t.size ); } }
...and place this script on the GameObject where you want the cube to appear:
#pragma strict @ExecuteInEditMode public class DrawWireCube extends MonoBehaviour { public var size: float = 5; }
using UnityEngine;
[ExecuteInEditMode] public class DrawWireCube : MonoBehaviour { public float size = 5; }