private void Awake() { if (PhotonRoomCustomMatch.room == null) { PhotonRoomCustomMatch.room = this; } else { if (PhotonRoomCustomMatch.room != this) { Destroy(PhotonRoomCustomMatch.room.gameObject); PhotonRoomCustomMatch.room = this; } } DontDestroyOnLoad(this.gameObject); }
private void Awake() { //set up singleton if (PhotonRoomCustomMatch.room == null) { PhotonRoomCustomMatch.room = this; } else { if (PhotonRoomCustomMatch.room != this) { Object.Destroy(PhotonRoomCustomMatch.room); // Destroy(PhotonRoom.room.gameObject); PhotonRoomCustomMatch.room = this; } } DontDestroyOnLoad(this.gameObject); }