using System.Collections; using System.Collections.Generic; using UnityEngine; public class ColliderPlay : MonoBehaviour { public bool isRepeat = true; bool isCanPlay = true; AudioSource source; public Animator animator; //public Animator animator2; // Start is called before the first frame update void Start() { source = GetComponent(); } private void OnTriggerEnter(Collider other) { if (other.gameObject.name == "XROriginHands" || other.gameObject.name == "Main Camera") { if (!isCanPlay) return; if (source != null) { if(animator != null) { source.Play(); animator.Play("zr_2_shiyi"); } else { source.Play(); if (!isRepeat) { isCanPlay = false; } } } } } }