using UnityEngine; public class LoopAnimationOn : MonoBehaviour { public string animationStateName; public Vector3 targetPosition; // ָ����Ŀ��λ�� private Animator animator; public int aa = 00; void Start() { animator = GetComponent(); if (animator == null) { Debug.LogError("Animator component not found on the object."); } } public void ResetAnimationPlay() { if (animator != null && !string.IsNullOrEmpty(animationStateName)) { // ���Ŷ��� Quaternion specificRotation = Quaternion.Euler(0, aa, 0); animator.Play(animationStateName, -1, 0f); // �ƶ����嵽ָ��λ�� if (targetPosition != null) { transform.localPosition = targetPosition; transform.rotation = specificRotation; } } else { Debug.LogError("Animation state name is not set or Animator is null."); } } }