- Home /
 
Voice Chat Script help?
I need some help with this code please. The other threads didn't really work, and in theory it should work, but the Camera I am using is either not picking it up or the code is wrong! Please help!
 #pragma strict
 
 function Start() {
     if(Input.GetKey("v")==true);
     {
      voiceChat==true;
     }
     
 }
 
 function voiceChat() {
 var aud = GetComponent.<AudioSource>();
     aud.clip = Microphone.Start("Built-in Microphone", true, 10, 44100);
     aud.Play();
     Debug.Log(Microphone.IsRecording);
     
 }
 
              
               Comment
              
 
               
              Answer by Caramida · Feb 02, 2016 at 05:28 PM
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); }
Your answer