Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Handles.DrawWireCube

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function DrawWireCube(center: Vector3, size: Vector3): void;
public static void DrawWireCube(Vector3 center, Vector3 size);

Parameters

center Position of the cube.
size Size of the cube.

Description

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; }