public void OnDisable() { if (instance == this) { instance = null; } }
public static void CreateObject(INearbyConnectionClient client) { if (instance != null) { return; } mClient = client; if (Application.isPlaying) { // add an invisible game object to the scene GameObject obj = new GameObject("PlayGames_NearbyHelper"); DontDestroyOnLoad(obj); instance = obj.AddComponent <NearbyHelperObject>(); } else { instance = new NearbyHelperObject(); } }