using FMODUnity; using System.Collections; using System.Collections.Generic; using UnityEngine; public class CollisionDetection : MonoBehaviour { [SerializeField] private EventReference m_FootstepAudio; // Start is called before the first frame update public delegate void onContactSoundDelegate(GameObject obj, float force, EventReference soundObject); public static onContactSoundDelegate m_PlaySoundOnContact; private void OnCollisionEnter(Collision collision) { if (collision.gameObject.name == "200x200") { m_PlaySoundOnContact?.Invoke(this.gameObject, collision.relativeVelocity.magnitude, m_FootstepAudio); } } }