public override void OnInspectorGUI() { _target = (AteComponent)target; _target.DrawInspector(); EditorHelper.SetDirtyIfChanged(_target); }
public void AddComponent_ByReference(AteComponent theComponent) { // Only add component if it isn't already in the components list if (!components.Contains(theComponent)) { components.Add(theComponent); } theComponent.SetMyObject(this); }
private static void DestroyThroughMyObject(MenuCommand command) { AteComponent component = command.context as AteComponent; if (component == null) { return; } component.DestroyThroughMyObject(); }
public void AddComponent_ByType(Type theType) { AteComponent theComponent = gameObject.AddComponent(theType) as AteComponent; if (theComponent == null) { return; } AddComponent_ByReference(theComponent); }
/// <summary> /// Called by components when they are removed. /// </summary> public void DestroyComponent(AteComponent theComponent) { components.Remove(theComponent); GameObject.DestroyImmediate(theComponent); #if UNITY_EDITOR if (!Application.isPlaying) { EditorUtility.SetDirty(this); // If it is a scene object if (!string.IsNullOrEmpty(this.gameObject.scene.name)) { EditorApplication.MarkSceneDirty(); } } #endif }