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);
         }
     }
 }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
 private void OnItemRenamed(object sender, SwatcherRenamedEventArgs e)
 {
     ItemRenamed?.Invoke(sender, e);
 }