NETWORK: Animator probleme. Unity 4.6.3.f1
Hi!
(I'm french so... sorrry for all mistake inside the text D:)
I have a little probleme in my game. I need animation for animated character and there is a probleme. In clientSide, all animations works, but... in serverSide, It is dosen't work at all! I don't know this probleme. I try to find a solution on google to see if other people have the same probleme than me and nobody have a solution D: I use the ANIMATOR and not the ANIMATION ! all people use animation and not animator. I try this:
using UnityEngine;
using System.Collections;
public class AnimationControllerSoldierTest : MonoBehaviour {
private Animator myAnimator;
public float VSpeed = 0.0f;
public float HSpeed = 0.0f;
private GameObject ModelAnimated;
private GameObject PlayerObject;
private Transform myTransform;
public int ChooseRandomAnim = 0;
//Set bool for stance.
public bool running = false;
// Use this for initialization
void Start ()
{
if (networkView.isMine == true)
{
myAnimator = GetComponent<Animator> ();
PlayerObject = transform.gameObject;
myTransform = transform;
ModelAnimated = myTransform.FindChild ("Swat_Animated").gameObject;
myAnimator = ModelAnimated.GetComponent<Animator>();
} else {
enabled = false;
}
}
// Update is called once per frame
void Update ()
{
//Random function.
//ChooseRandomAnim = Random.Range (0, 3);
//Right & Left; Forward & Backward.
//VSpeed = myAnimator.SetFloat("VSpeed", Input.GetAxis ("Vertical"));
//HSpeed = myAnimator.SetFloat ("HSpeed", Input.GetAxis ("Horizontal"));
VSpeed = Input.GetAxis ("Vertical");
HSpeed = Input.GetAxis ("Horizontal");
networkView.RPC("SendFloatHorizontalAndVertical", RPCMode.All, VSpeed, HSpeed);
ModelAnimated.transform.localPosition = new Vector3(0,-1,0);
}
[RPC]
void SendFloatHorizontalAndVertical(float VSpeedRPC, float HSpeedRPC)
{
myAnimator.SetFloat("VSpeed", VSpeedRPC);
myAnimator.SetFloat("HSpeed", HSpeedRPC);
//myAnimator.CrossFade("Walk_forward", 1f, 0, 10f);
}
}
There is no error in the debugger.
this line: ModelAnimated.transform.localPosition = new Vector3(0,-1,0); is used for replace the player near the floor.
is my RPC is wrong? is my method is wrong? Is my script wrong?
Realy, I don't know. Thanks people if you help me :D
Your answer
Follow this Question
Related Questions
Animating physics problem 1 Answer
How to implement NetCode to Unity physics (new one, with Havok) 0 Answers
Animations are not playing. 1 Answer
Can't Open Exit Time Settings 0 Answers