// ------------------------------------------- /* * StartVoiceStreaming */ public void StartVoiceStreaming(bool _emitVoice) { object voiceFoun = Resources.Load("Voice/Voice Connection and Recorder"); bool voiceHasBeenFound = false; if (voiceFoun != null) { GameObject voicePrefab = voiceFoun as GameObject; if (voicePrefab != null) { voiceHasBeenFound = true; m_voiceGO = GameObject.Instantiate(voicePrefab); ConnectAndJoin joinVoice = m_voiceGO.transform.GetComponentInChildren <ConnectAndJoin>(); m_voiceConnection = GameObject.FindObjectOfType <VoiceConnection>(); m_voiceConnection.SpeakerLinked += this.OnSpeakerCreated; if ((joinVoice != null) && (m_voiceConnection != null)) { joinVoice.RoomName = PhotonNetwork.CurrentRoom.Name; m_voiceConnection.PrimaryRecorder.TransmitEnabled = _emitVoice; joinVoice.ConnectNow(); NetworkEventController.Instance.DispatchLocalEvent(EVENT_PHOTONCONTROLLER_VOICE_CREATED, m_voiceConnection.gameObject.transform); } } } if (!voiceHasBeenFound) { Debug.LogError("StartVoiceStreaming::PREFAB VOICE NOT FOUND!!!!!!!!!!!!!!!!"); } }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(autoConnectSp); EditorGUILayout.PropertyField(autoTransmitSp); EditorGUILayout.PropertyField(randomRoomSp); if (!randomRoomSp.boolValue) { EditorGUILayout.PropertyField(roomNameSp); } if (Application.isPlaying && !connectAndJoin.IsConnected) { if (GUILayout.Button("Connect")) { connectAndJoin.ConnectNow(); } } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }