Esempio n. 1
0
 void OnDestroy()
 {
     m_referenceCount--;
     if (m_referenceCount == 0)
     {
         m_instance = null;
     }
 }
Esempio n. 2
0
        void Start()
        {
            GizmoFollow g = (GizmoFollow)FindObjectOfType(typeof(GizmoFollow));

            if (g)
            {
                gizmo = g.transform;
            }
            this.enabled = g;
        }
Esempio n. 3
0
        void Awake()
        {
            m_referenceCount++;
            if (m_referenceCount > 1)
            {
                DestroyImmediate(this.gameObject);
                return;
            }

            m_instance = this;
            // Use this line if you need the object to persist across scenes
            //DontDestroyOnLoad(this.gameObject);
        }