Example #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #2
0
        private void Awake()
        {
            if (instance == null)
            {
                instance = this;
                DontDestroyOnLoad(this.gameObject);

                sceneChangeAction.onStateDown += (SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource) =>
                {
                    if (fromSource == SteamVR_Input_Sources.RightHand)
                    {
                        NextScene();
                    }
                    else
                    {
                        PreviousScene();
                    }
                };
            }
            else
            {
                Destroy(gameObject);
            }
        }