Multiplayer Animations

function Awake(){
	//if(networkView.isMine){
	//	this.enabled = false;
	//	return;
	//}
}

function Update () {

	if(networkView.isMine){
		if(Input.GetAxis("Vertical")){
			//networkView.RPC("DoAnimations", RPCMode.All, networkView.viewID, 1);
			animation.CrossFade("Run01");
		}
		else{
			animation.CrossFade("Idle01");
		}
	}
}

@RPC function DoAnimations(view : NetworkViewID, animState : int){
	var id : NetworkView = NetworkView.Find(view);
	var t : Transform = id.gameObject.transform;
	
	switch(animState){
		case 0 :
			t.gameObject.GetComponent(Animation).animation.CrossFade("Idle01");
			break;
		case 1 :
			t.gameObject.GetComponent(Animation).animation.CrossFade("Run01");
			break;
	}
}

Hello again , this is becoming quite reoccuring.

Heres the thing this time. I hvae a GameObject with a movement script , collider, rigidbody etc… and as a child of this gameObject, i have a model gameObject, with a couple animations applied to it. Both of these gameObjects have a networkView attached, the parent object set to observe its transform, and also the child objects observe is set to the transform. It should be noted that i have tried observing the animations component directly as well.

Now, all players start out fine, and see each others idle animations… but when players move around , none of their other animations are observed by any other player.

I have tried several methods , including using RPC to send data , but nothing seems to be working. I am so bad at networking ugh! , lol. Hers the script attached to the child object with animation component.

Unless animations are extremely important to be accurate and in synch, I wouldn’t send any information through the network.

Just make your animation script apply animations based on the CharacterController / Rigidbody movements (i.e.: if the character is moving forward, play the “walk” animation; if he jumps, play the “jump” animation).

That way, the animation script can be on both your character and the other network player’s characters, and you don’t have to send any information whatsoever for the animation.

If you look at any Unity multiplayer tutorial or sample (there’s an MMO movement one around), that’s how they usually do it.

Ahh , thank you kind sir , i now have my animations over the network working, thanks :stuck_out_tongue: