Name of Script; NewName
using UnityEngine;
public class NewName : MonoBehaviour
{
Animator animator;
// Start is called before the first frame update
private void Start()
{
animator = GetComponent();
}
// Update is called once per frame
private void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.Q))
{
animator.SetTrigger("Attack1");
}
if (Input.GetKeyDown(KeyCode.W))
{
animator.SetTrigger("attack");
}
if (Input.GetKeyDown(KeyCode.E))
{
animator.SetBool("walk", true);
}
if (Input.GetKeyUp(KeyCode.E))
{
animator.SetBool("walk", false);
}
}
}
that is not adding to the game object
how can i solve it?
↧