every time i press play then press Fire1 to play my animation it gives me two warnings, they are “Animator.GotoState: State could not be found
UnityEngine.Animator:Play (string” And “Invalid Layer Index ‘-1’
UnityEngine.Animator:Play (string)” My code is:
- using System.Collections.Generic;
using UnityEngine;
using System.Collections;
public class AttackSequence : MonoBehaviour
{
public GameObject Tanjiros_Nirichin_sword;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
AttackAnim();
}
}
void AttackAnim ()
{
Tanjiros_Nirichin_sword.GetComponent<Animator>().Play("AttackAnimation");
}
}
And yes i am making a demon slayer game because you can clearly see this in my code
“public GameObject Tanjiros_Nirichin_sword;”
,