Hi, i’d like make a voice chat script for my online fps game but i don’t have any ideas how can i make it
i searched in this site and found some solutions but it didn’t work.
(Multiplayer Voice Chat? - Unity Answers)
my code :
#pragma strict
function Start () {
InvokeRepeating ("OnConnectedToServer", 1, 1);
InvokeRepeating ("PlayMicrophone", 1, 1);
}
function Update () {
}
@RPC
function PlayMicrophone()
{
audio.clip = Microphone.Start("", true, 100, 44100);
audio.loop = true;
while (!(Microphone.GetPosition("") > 0)){}
audio.Play();
}
function OnConnectedToServer()
{
networkView.RPC("PlayMicrophone", RPCMode.Others);
}