/// <summary> /// in 'Awake' we do things that need to be run once at the /// very beginning. NOTE: 1) this method must be run using /// 'base.Awake();' on the first line of the 'Awake' method /// in any derived class. 2) keep in mind that as of Unity 4, /// gameobject hierarchy can not be altered in 'Awake' /// </summary> protected virtual void Awake() { EventHandler = (vp_EventHandler)Transform.root.GetComponentInChildren(typeof(vp_EventHandler)); CacheChildren(); CacheSiblings(); CacheFamily(); CacheRenderers(); CacheAudioSources(); m_StateManager = new vp_StateManager(this, States); StateManager.SetState("Default", enabled); }
protected virtual void Awake() { this.m_Transform = base.transform; this.m_Parent = base.transform.parent; this.m_Root = base.transform.root; this.m_Audio = base.GetComponent <AudioSource>(); this.EventHandler = (vp_EventHandler)this.m_Transform.root.GetComponentInChildren(typeof(vp_EventHandler)); this.CacheChildren(); this.CacheSiblings(); this.CacheFamily(); this.CacheRenderers(); this.CacheAudioSources(); this.m_StateManager = new vp_StateManager(this, this.States); this.StateManager.SetState("Default", base.enabled); }
/// <summary> /// in 'Awake' we do things that need to be run once at the /// very beginning. NOTE: 1) this method must be run using /// 'base.Awake();' on the first line of the 'Awake' method /// in any derived class. 2) keep in mind that as of Unity 4, /// gameobject hierarchy can not be altered in 'Awake' /// </summary> protected virtual void Awake() { m_Transform = transform; m_Parent = transform.parent; m_Root = transform.root; m_Audio = audio; EventHandler = (vp_EventHandler)m_Transform.root.GetComponentInChildren(typeof(vp_EventHandler)); CacheChildren(); CacheSiblings(); CacheFamily(); CacheRenderers(); CacheAudioSources(); m_StateManager = new vp_StateManager(this, States); StateManager.SetState("Default", enabled); }
////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////// public void Awake() { m_StateManager = new vp_StateManager(this, States); StateManager.SetState("Default", enabled); }