Animator Is Not A Playable Error.
I am trying to make my player move with its animation i made. I made a script to allow it to move with WASD and Arrow keys and i made a separate script for the animations.
Moving Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
public float moveSpeed;
void Start ()
{
moveSpeed = 6f;
}
void Update ()
{
//Trigger Movement
transform.Translate(moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime, 0f, moveSpeed * Input.GetAxis ("Vertical") * Time.deltaTime);
}
}
}
Animation Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Animations : MonoBehaviour {
public Animator anim;
public KeyCode MoveW;
public KeyCode MoveA;
public KeyCode MoveS;
public KeyCode MoveD;
void Start () {
}
void Update () {
//Trigger Move Animation
if (Input.GetKeyDown(MoveW))
{
anim.SetTrigger("MoveTrigger");
}
}
}
Comment
Answer by UnityCoach · Feb 28, 2017 at 01:40 PM
Check that :
The object bearing the Animator component is active
The Animator has an Animator Controller assigned
Your answer
Follow this Question
Related Questions
Logic for a lot of animations 0 Answers
Door animation bugs and stays open unity 3D 0 Answers
MobController 1 Answer
stickman animation 1 Answer
Animation State not working 1 Answer