using System.Collections; using System.Collections.Generic; using UnityEngine; public class AudioHolder : MonoBehaviour { AudioSource SoundEmitter; private void OnEnable() { // Add delegate Trigger.OnGlassTriggered += PlaySound; } private void OnDisable() { // Remove delegate Trigger.OnGlassTriggered += PlaySound; } // Start is called before the first frame update void Start() { SoundEmitter = GetComponent(); } private void PlaySound() { SoundEmitter.Play(); } }