private void OnHierarchyChange() { if (target is MonoBehaviour bh && target is IIdentifiableItemAuthoring item && bh != null) { if (item.Name != bh.gameObject.name) { var oldName = item.Name; item.Name = bh.gameObject.name; ItemRenamed?.Invoke(item, oldName, bh.gameObject.name); } } }
protected void OnPreInspectorGUI() { if (!(target is IItemMainAuthoring item)) { return; } EditorGUI.BeginChangeCheck(); var val = EditorGUILayout.TextField("Name", item.ItemData.GetName()); if (EditorGUI.EndChangeCheck()) { FinishEdit("Name", false); item.ItemData.SetName(val); } EditorGUI.BeginChangeCheck(); var newLock = EditorGUILayout.Toggle("IsLocked", item.IsLocked); if (EditorGUI.EndChangeCheck()) { FinishEdit("IsLocked"); item.IsLocked = newLock; SceneView.RepaintAll(); } if (target is IIdentifiableItemAuthoring identity && target is MonoBehaviour bh) { if (identity.Name != bh.gameObject.name) { var oldName = identity.Name; identity.Name = bh.gameObject.name; ItemRenamed?.Invoke(identity, oldName, bh.gameObject.name); } } }
private void OnItemRenamed(object sender, SwatcherRenamedEventArgs e) { ItemRenamed?.Invoke(sender, e); }