Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Handles.CubeCap

マニュアルに切り替える
public static void CubeCap(int controlID, Vector3 position, Quaternion rotation, float size);

パラメーター

controlID ハンドルのコントロール ID
position ハンドルを開始するワールドスペースの位置
rotation ハンドルの回転
size ワールドスペースユニットでのハンドルのサイズ

説明

キューブを描き、これをハンドル関数に渡します。

注意: 画面サイズに対して固定サイズのハンドルを持ちたい場合、 HandleUtility.GetHandleSize を使用します。


" シーンビューの Cube Cap "

この例を使用するには、以下のスクリプトを Assets/Editor フォルダーに保存します。

using UnityEngine;
using UnityEditor;

[CustomEditor( typeof( DummyCubeCap ) )] public class CubeCapEditor : Editor { public float cubeSize = 1;

void OnSceneGUI( ) { DummyCubeCap t = target as DummyCubeCap;

Handles.color = Color.red; Handles.CubeCap( 0, t.transform.position + new Vector3( 5, 0, 0 ), t.transform.rotation, cubeSize );

Handles.color = Color.green; Handles.CubeCap( 0, t.transform.position + new Vector3( 0, 5, 0 ), t.transform.rotation, cubeSize );

Handles.color = Color.blue; Handles.CubeCap( 0, t.transform.position + new Vector3( 0, 0, 5 ), t.transform.rotation, cubeSize ); } }

スクリプトはエディターでボタンを表示したいオブジェクトにアタッチします。:

using UnityEngine;

[ExecuteInEditMode] public class DummyCubeCap : MonoBehaviour { public void Start( ) { Debug.Log( "I have CubeCap Handles attached to this transform!" ); } }