반응형
- 코드 작성
using UnityEngine;
public class AnimationExample : MonoBehaviour
{
private Animator animator;
private void Start()
{
animator = GetComponent<Animator>();
}
private void Update()
{
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
animator.SetFloat("Horizontal", horizontal);
animator.SetFloat("Vertical", vertical);
animator.SetFloat("Speed", Mathf.Abs(horizontal) + Mathf.Abs(vertical));
}
}
반응형