Editor GetComponentEditor(GameObject obj, string createText, string destroyText, ref GamePrefabComponentEditor componentEditor) { System.Type componentType = componentEditor.componentType; Component comp = obj.GetComponent(componentType); if (!comp) { if (GUILayout.Button(createText)) { comp = obj.AddComponent(componentType); } } else { if (GUILayout.Button(destroyText)) { DestroyImmediate(comp); componentEditor.DestroyEditor(); } } if (componentEditor.component != comp) { componentEditor.DestroyEditor(); componentEditor.CreateEditor(comp); } return(componentEditor.editor); }
Editor GetForcedComponentEditor(GameObject obj, ref GamePrefabComponentEditor componentEditor) { System.Type componentType = componentEditor.componentType; Component comp = obj.GetComponent(componentType); if (!comp) { comp = obj.AddComponent(componentType); } if (componentEditor.component != comp) { componentEditor.DestroyEditor(); componentEditor.CreateEditor(comp); } return(componentEditor.editor); }
void FlushEditors() { desc.DestroyEditor(); equip.DestroyEditor(); pickup.DestroyEditor(); }