private void Awake() { lock (singletonLock) { GameSparksUnity[] instances = GameObject.FindObjectsOfType <GameSparksUnity>(); if (instances != null && instances.Length > 1 && instance != this) { Debug.Log("Destroying duplicate GameSparksUnity game object."); Destroy(this); } else { instance = this; } } }
void Awake() { Instance = this; SlGS = gameObject.AddComponent <GameSparksUnity>(); }