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

スクリプト言語

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

EditorUtility.CollectDependencies

マニュアルに切り替える
public static Object[] CollectDependencies(Object[] roots);

パラメーター

説明

roots に依存するすべてのアセットを計算し、取得します


ゲームオブジェクトの非表示を設定する EditorWindow

using UnityEngine;
using UnityEditor;

public class CollectDependenciesExample : EditorWindow { static GameObject obj = null;

[MenuItem( "Example/Collect Dependencies" )] static void Init( ) { // Get existing open window or if none, make a new one: CollectDependenciesExample window = (CollectDependenciesExample)EditorWindow.GetWindow( typeof(CollectDependenciesExample) ); window.Show( ); }

void OnGUI( ) { obj = EditorGUI.ObjectField( new Rect( 3, 3, position.width - 6, 20 ), "Find Dependency", obj, typeof(GameObject) ) as GameObject;

if( obj ) { Object[] roots = new Object[] { obj };

if( GUI.Button( new Rect( 3, 25, position.width - 6, 20 ), "Check Dependencies" ) ) Selection.objects = EditorUtility.CollectDependencies( roots ); } else EditorGUI.LabelField( new Rect( 3, 25, position.width - 6, 20 ), "Missing:", "Select an object first" ); } void OnInspectorUpdate( ) { Repaint( ); } }