public override void OnEnable() { base.OnEnable(); mps = MultiplayerSetting.Instance; PhotonNetwork.AddCallbackTarget(this); SceneManager.sceneLoaded += OnSceneFinishedLoading; }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); PhotonRoom.room.mps = this; }
private void Awake() { if (MultiplayerSetting.multiplayerSetting == null) { MultiplayerSetting.multiplayerSetting = this; } else { if (MultiplayerSetting.multiplayerSetting != this) { Destroy(this.gameObject); } } DontDestroyOnLoad(this.gameObject); }
private void Awake() //Singletonにする。ひとつしか、「この」インスタンスを存在させない。無かったら「これ」を作り、あれば「これ」をDestroy { if (MultiplayerSetting.multiplayerSetting == null) { MultiplayerSetting.multiplayerSetting = this; } else { if (MultiplayerSetting.multiplayerSetting != this) { Destroy(this.gameObject); } } DontDestroyOnLoad(this.gameObject); //これって「this」がない場合があるんじゃないのか? }
private void Awake() { if (MultiplayerSetting.single_MPS) { if (MultiplayerSetting.single_MPS != this) { Destroy(this.gameObject); } } else { MultiplayerSetting.single_MPS = this; } DontDestroyOnLoad(this.gameObject); }
private void Awake() { if (instance == null) { instance = this; } else { if (instance != this) { Destroy(this.gameObject); } } DontDestroyOnLoad(this.gameObject); //TEST CODE: Make the game windowed to make testing easier Screen.fullScreen = false; }