UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"On trigger touch, start specific sound"
using UnityEngine; public class OnTriggerPlaySound : MonoBehaviour { public AudioClip sound; private AudioSource audioSource; private void Start() { audioSource = GetComponent<AudioSource>(); } private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { audioSource.PlayOneShot(sound); } } }