// Use this for initialization private void Start() { if (ActivateObject != null) { AttachedObject = ActivateObject.GetComponent <IActivatableObject>(); } }
protected virtual void AddComponent(IActivatableObject obj) { if (children.Contains(obj)) { Debug.Fail("Trying to add same component twice" + obj.ToString()); } children.Add(obj); }
protected virtual void RemoveComponent(IActivatableObject obj) { children.Remove(obj); }
/// <summary> /// Add a component to this Canvas /// All added components have their Update() called by the framework /// during each frame. The call order is the addition order /// </summary> /// <remarks> /// Component can be added only once. /// </remarks> /// <param name="obj">Component to add</param> public virtual void AddComponent(IActivatableObject obj) { Debug.Assert(!children.Contains(obj), "Trying to add same component twice!"); this.children.Add(obj); }