Hi guys. I’m trying to play an audio clip in my game when a ball hits a stump. The problem appears to be that the collision between the 2 game objects is not getting detected and as a result no audio is played.
I have attached the following code to the wicket to check if the collision is being recognized:
pragma strict
var clip : AudioClip;
function Start () {
}
function OnCollisionEnter (collision : Collision) {
if (collision.collider.gameObject.tag == “ball”){
AudioSource.PlayClipAtPoint(clip, transform.position);
Debug.Log(“Out!!!”);
}
}
The Unity Console does not show any collisions even though the collisions are apparent when you play the game. Any ideas?