Only the master client can talk but the client can only hear, how to make both of them talk.
Sample script.
public class VoiceController : MonoBehaviour { public Text ConnectionStatus; public Text PlayerStatus; public GameObject VoicePrefab; PhotonVoiceRecorder Rec; public Transform Parent; int Count = -1; public void ClickTOConnect() { PhotonNetwork.ConnectUsingSettings("0.1"); } public void StartProcess() { PhotonNetwork.JoinOrCreateRoom("XYZ", null, null); } void OnJoinedRoom() { if (PhotonNetwork.isMasterClient == true) { PlayerStatus.text = "MASTER"; } else { PlayerStatus.text = "CLIENT"; } } private void Update() { ConnectionStatus.text = PhotonNetwork.connectionStateDetailed.ToString(); } public void StartVoice() { CALLER(); } public void CALLER() { Rec = Instantiate(VoicePrefab, Parent).GetComponent<PhotonVoiceRecorder>(); } public void PushTOTalk() { if (Count == -1) { Rec.Transmit = true; Count = 0; } else { Rec.Transmit = false; Count = -1; } } }
0
Comments
-
Hi @Krishna_jokerTM,
Thank you for choosing Photon!
I can't help you with this code only.
I can't see whenStartVoice
orPushTOTalk
are called.
What do you see in the logs? any errors?
What Photon Voice Classic version are you using?
What Unity version are you using?
How are you testing? from build and from Editor?
What target platform are you using?0 -
Both are button events, push to talk is a toggle and start voice will instantiate a prefab that contains photonview recorder and speaker. I figured out you are creating a prefab in master when a client joins and that has the same photonview with only speaker. How to do that?0
-
Ah I see now.
replaceInstantiate
withPhotonNetwork.Instantiate
.0 -
Wow, Thanks bro!!!0