public void OnUpdate() { if (currentLevelId == 1) { try { if (StartGameScript.playingOnline) { PlayerBody me = PlayerBody.localPlayer; if (voiceToggleButton == null) { createVoiceButton(); } if (me != null) { voiceToggleButton.Update(me); } if (voiceToggleButton.buttonPressed) { if (voiceToggleButton.isButtonOn) { PhotonVoiceNetwork.Disconnect(); } else { PhotonVoiceNetwork.Connect(); } me.DisplayMessageInFrontOfPlayer("Voice is " + (voiceToggleButton.isButtonOn ? "off" : "on")); } } } catch (Exception e) { } } }