- Home /
Networked Animations Play Partially Or Not At All
Hey all,
I am currently working on getting movement animations to play over a network in my multiplayer Unity3D game. What I need to happen is for my opponent to see my animations whenever I am playing them locally, and so far the most I can get them to do from my opponent's perspective is skip to a frame in the middle of the animation. The object being animated is the same prefab locally and over the network.
My observations so far:
-The run animation plays perfectly on a local machine, so this should mean that there's nothing wrong with the animation clip itself.
-When I use an RPC to call .Play(string), the position of the character jumps from the starting non-animated pose to a frame about midway through the run animation
-When I use an RPC to call .CrossFade(string) or directly change out .clip, or if I set a NetworkView component to watch the animation component, the character stays in the starting non-animated pose
-My code is as follows. Both the RPC trigger and the function call are in the same script, so variable definitions are the same between the two:
Variable Definitions:
RobotAnimation = GetComponentInChildren<Animation> () as Animation;
nView = GetComponent<NetworkView>();
The RPC Trigger, called in the Update loop when the player moves:
RobotAnimation.Play("bot_idle");
nView.RPC("playNetworkAnimation",RPCMode.Others,"bot_idle");
The RPC Function:
[RPC]
void playNetworkAnimation(string animName){
if(!nView.isMine){
Debug.Log("playing animation: "+animName + " on: "+nView.viewID);
RobotAnimation.Play(animName);
}
}
-The Debug.Log gives the correct animation name and viewID, so I know that the animation should be playing, and on the correct object.
have tried using `RobotAnimation.IsPlaying(string)` to only call .Play(string) once instead of every frame, but that had the same effect as calling .Play(string) normally.
What else is there that I can try doing to get this working? Any thoughts or suggestions would be greatly appreciated!