言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

DrawGizmo

Namespace: UnityEditor

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

Sumbission failed

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

Close

Cancel

Description

DrawGizmo 属性により任意の Component の Gizmo レンダラーを提供します。

The renderer function must be static, and take two parameters: the object for which the gizmo is being drawn, and a GizmoType parameter which indicates the context in which the gizmo is being drawn. The renderer function can be defined in any class, including editor scripts. This allows you to keep your gizmo-drawing code out of your component scripts so that it is not included in builds.

	[DrawGizmo (GizmoType.Selected | GizmoType.Active)]
	static void DrawGizmoForMyScript (MyScript scr, GizmoType gizmoType) {
	    
	    Vector3 position = scr.transform.position;
		
		if(Vector3.Distance(position, Camera.current.transform.position) > 10f)
		    Gizmos.DrawIcon (position, "MyScript Gizmo.tiff");
	}

See Also: GizmoType.

Constructors

DrawGizmo Gizmo が描画を実行するタイミングを定義します