PlayAnimAuto.cs 337 B

1234567891011121314151617
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DTYJ
  5. {
  6. public class PlayAnimAuto : MonoBehaviour
  7. {
  8. private void OnEnable()
  9. {
  10. var anim = GetComponent<Animation>();
  11. anim[anim.clip.name].normalizedTime = 0;
  12. anim.Play();
  13. }
  14. }
  15. }