- Home /
The question is answered, right answer was accepted
Animation & sound over network
Hello! I'm currently trying to build a test multiplayer FPS game to learn. Everything else works except the animation and sound over network. The client that plays sound and animation can see it, but the other clients (or server) can't. For sound, can I just put @RPC(IDK why that links up to a user account but anyway) infont of the function that calls the sound and network.instantiate the physical sound(sound attached to an empty) and play it on awake? For animation, I have seen a lot of Q&As. But I do not understand what they are saying xD I learn faster with a test script and modifying it on my own and studying it. They make a test script but I don't understand a bit. Can you please put a test script describing bits and pieces on the animation script? Like using //. I'm sorry if I'm posting another question even though there are questions like this everywhere. Thank you(future tense)!
Answer by mr_poo2 · Jun 30, 2013 at 11:56 PM
this is how i got the crouch animation on my game to work and everyone connected sees it put a network view on every object animating and this script does the rest
#pragma strict
var crouch : boolean = false;
function Update () {
if(networkView.isMine == true){
if(Input.GetKeyDown("c") && crouch == false){
// if i press c and i have not crouched the animation will play and go to the function fun1
animation.Play("Crouch");
fun1();
}
if(Input.GetKeyDown("c") && crouch == true){
// if i press c and i have crouched then it will play the animation to go back to normal and set crouch to false
animation.Play("Default");
crouch = false;
}
}
}
function fun1 () {
// it will wait 1 seccond then set crouch to true
yield WaitForSeconds(1);
crouch = true;
}
Thanks bro. You didn't have to describe all the pressing c and function stuff but anyway, thanks. All I needed to know was to have network view for every object animated. Thanks.
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Network animations 2 Answers
.io style matchmaking (one button matchmaking) 1 Answer
Networking??? 2 Answers