- Home /
Animations via network
Good day, I am busy with a simple adventure game, and I am working on the online animations. The movement and positions is working fine, but the character does not walk (animate) on the partner's screen. Now I know accurate animations can eat bandwidth, and in my case it is not critical. My question is how to get the animations to work via network. I have asked in the forum, with no concrete answers here. In fact I cannot find ONE tutorial on how to transmit ANIMATIONS via network. not movement and positions,but ANIMATIONS.
If someone could help me I will really appreciate it.
Best regards,
What I plan to do in my game is to just stream an int.
1 = forward walk. 2 = backwards walk. 3 = idle.
Etc.
And then play the appropiate animations based on the received int.
@OrangeLightning Please convert your comment to an answer, as it answers the question perfectly :)
Actually, he didn't answer the question, He merely stated how he plan to do it. Remember, for us indie folks, "stream an int" means nothing if you don't know how to do it. If there is no form of guide, for example say "place this or that in your networking script", I/we are just as lost as in the beginning. Yes, I know there is documentation, and I have read through most of it, but some of us just do tjis as a hobby, with limited knowledge, and learns more by examples than by documentation ;)
I appreciate the answer, though. It gives me a new direction on my search for answers.
Thanks,
Jakes
Answer by KiraSensei · May 22, 2013 at 07:21 AM
enum animations { idle, forward, backwards };
@RPC
function NetworkAnimate (anim:int) {
switch (anim) {
case animations.idle:
animation.Play("idle");
break;
case animations.forward:
animation.Play("forward");
break;
case animations.backwards :
animation.Play("backwards");
break;
}
When you want to call an animation, you need to call :
networkView.RPC("NetworkAnimate", RPCMode.All, 0);
to play idle for example.
Thank you for this example. I had a different approach where I tried to sync the State names.. Didn't really work. But with Integers it works really nice.
Glad I could help someone, the person who asked the question never answered to me :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613101215im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Locomotion animation syncing across network. 0 Answers
Unity networking tutorial? 6 Answers
Unity multiplayer Animations Over a network etc 1 Answer
Multiplayer Animations Sync Problem 0 Answers
Network Discovery is not working over multiple devices. 1 Answer