private void Start() { if (!linkedGameObject || isWatched) { return; } // Send another component to the object that we are watching. GameObjectIsActiveLink otherLink = linkedGameObject.AddComponent <GameObjectIsActiveLink>(); otherLink.isWatched = true; otherLink.linkedGameObject = gameObject; UpdateState(linkedGameObject.activeInHierarchy); }
public override void OnInspectorGUI() { GameObjectIsActiveLink script = (GameObjectIsActiveLink)target; if (!script.isWatched) { DrawDefaultInspector(); return; } GUILayout.Label("This object is syncing its state with Linked Game Object."); System.Collections.Generic.List <string> excludedProperties = new System.Collections.Generic.List <string>(); excludedProperties.Add("invert"); DrawPropertiesExcluding(serializedObject, excludedProperties.ToArray()); serializedObject.ApplyModifiedProperties(); }