How to i fix this animation error?
The animation state SwordAttack could not be played because it couldn't be found! Please attach an animation clip with the name 'SwordAttack' or call this function only for existing animations. UnityEngine.Animation:Play(String, PlayMode) SwordAnimation:Update() (at Assets/SwordAnimation.cs:14)
This is my error, and i try to make a sword attack animation, here is my code: using UnityEngine; using System.Collections;
public class SwordAnimation : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown (0)) {
GetComponent<Animation>().Play("SwordAttack", PlayMode.StopAll);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
I want to animate with SetTrigger? 0 Answers
Animation,God! 1 Answer
The name animator does not exist in the current context... Help? 1 Answer
.IsPlaying does not exist? 1 Answer