Version: 2022.2
Method group is Obsolete

EditorApplication.hierarchyWindowChanged

切换到手册
Obsolete public static EditorApplication.CallbackFunction hierarchyWindowChanged ;

描述

当层级视图中的对象发生更改时将引发的回调。

每次创建对象(或对象组)或对其进行重命名、定父级、取消父级或销毁时,都会引发此回调。

另请参阅:EditorWindow.OnHierarchyChange

using UnityEditor;
using UnityEngine;

public class ExampleCode { [MenuItem("Example/Hierarchy Window Changed")] static void Example() { EditorApplication.hierarchyWindowChanged += ExampleCallback; }

static void ExampleCallback() { Object[] all = Resources.FindObjectsOfTypeAll(typeof(Object)); Debug.Log("There are " + all.Length + " objects at the moment."); } }

**注意**:更改对象上的 HideFlags 也会导致调用此回调。