Beispiel #1
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;                 // This MonoBehaviour is being destroyed, so set the static instance property to null.
     }
 }
Beispiel #2
0
        private void Awake()
        {
            if (Instance != null)
            {
                Plugin.Log?.Warn($"Instance of {GetType().Name} already exists, destroying.");
                GameObject.DestroyImmediate(this);
                return;
            }
            GameObject.DontDestroyOnLoad(this);
            Instance = this;

            assetBundle = AssetBundleManager.LoadAssetBundleFromResource($"SpectroSaber.spectrosaber");
        }