Example #1
0
 void OnDestroy()
 {
     if (current == this) {
         Reset();
         current = null;
     }
 }
Example #2
0
        void Awake()
        {
            if (current != null) {
                Debug.LogError("Only 1x Parallax2D script may be active at a time. Delete the current Parallax2D script before creating a new one. Aborting.");
                Destroy(gameObject);
                return;
            }

            current = this;
        }