Alsow this problem starts in here:Play animation with FPS controller? - Questions & Answers - Unity Discussions
Find solution access Animation script with GetComponent command it worked well but still have a problem Script say it can’t find the animation, maybe some one have some idea about this
Vector3 targetVelocity =newVector3(Input.GetAxis(“Horizontal”), 0, Input.GetAxis(“Vertical”));
targetVelocity = transform.TransformDirection(targetVelocity);
targetVelocity *= speed;
// Apply a force that attempts to reach our target velocity
Vector3 velocity = rigidbody.velocity;
Vector3 velocityChange = (targetVelocity - velocity);
velocityChange.x =Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
velocityChange.z =Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
velocityChange.y =0;
rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);
GetComponent();
And we go to the animation scrip here it is:
using UnityEngine;
using System.Collections;
publicclassMainControlAnimation : MonoBehaviour {
publicAnimator PlayerController;
// Use this for initialization
void Start () {
PlayerController = GetComponent();
}
// Update is called once per frame
void Update () {
if (Input.GetAxis(“Vertical”) !=0)
{
animation.Play(“walkAnimation”);
}
elseif (Input.GetAxis(“Vertical”) !=0)
{
animation.Play(“walkAnimation”);
}
else
{
animation.Play(“idleAnimation”);
}
}
}
It send a request to play an animation but cant find it, also here is pic of Animation controller maybe an issue is there but I can’t understand where:


