コード例 #1
0
 private void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
コード例 #2
0
        private void Awake()
        {
            // Only allow one instance of the API bridge.
            if (_instance != null)
            {
                UnityEngine.Debug.LogWarning("Removing duplicate Kongregate API GameObject, only one may be active at a time");
                Destroy(gameObject);
                return;
            }

            // Make this object the current instance and ensure that it isn't destroyed
            // on scene loads.
            _instance = this;
            DontDestroyOnLoad(gameObject);

            initKongregateAPI(name);
        }