how to play sound onmouseover

hi,,i have a target in my scene all i want to do is when i move my mouse to the middle of that target a sound must play..

script 1: var sound : AudioScript; inside if condition i ll write sound.start(); // Here m getting error: object reference not set to an instance of object

script 2(AudioScript)

var soundName : AudioClip;

function start() { Debug.Log("Audio"); audio.PlayOneShot(soundName); } please help

1 Answer

1

You need to wire the 'sound' variable in your first component up to your second component.