Before moving on, let's add a sound effect when the ball bounces. If you've installed the BallGameArt assets, there's a sound effects folder with a sound named bounce. We'll play the clip when the ball collides with anything. Let's script it now and we'll explain colliders more when we add the GoalCollider later.
In your Project Assets/ARPlayBall/Scripts folder create a new C# script named PlaySoundOnHit and open it for editing:
File: PlaySoundOnHit.csusing UnityEngine; [RequireComponent(typeof(AudioSource))] public class PlaySoundOnHit : MonoBehaviour { public AudioClip clip; private AudioSource source; void Start() { source = GetComponent<AudioSource>(); source.spatialBlend = 1.0f; source.playOnAwake = false; source.clip ...