Example #1
0
 protected void OnDestroy()
 {
     if (m_Instance.Equals(this))
     {
         m_Instance = null;
     }
 }
Example #2
0
        protected void Awake()
        {
            // Prevent multiple
            if (m_Instance != null)
            {
                Destroy(this.gameObject);
                return;
            }

            m_Instance = this;
            DontDestroyOnLoad(this.gameObject);

            if (this.m_Raycaster == null)
            {
                this.m_Raycaster = this.gameObject.GetComponent <GraphicRaycaster>();
            }
            if (this.m_Raycaster != null)
            {
                this.m_Raycaster.enabled = false;
            }
        }