play sounds on another gameObject

Hi, is there a way for a gameObject to play sounds on another gameObject?

i ask because I have a menu system with 8 buttons- all child objects of an empty gameObject. The empty gameObject has an AudioSource component and all the sounds attached via a script:

var sound1 : AudioClip; var sound2 : AudioClip; etc...

rather than have an audiosource for each button, can the buttons-when pressed-access and play the audioclip on the Empty gameObject? Needless to say, what I have now doesn't work:

if(guiTexture.HitTest(Input.mousePosition) && Input.GetMouseButtonUp(0)){ emptyGameObject.audio.PlayOneShot(sound1); }

Is anything like this possible?

Thanks in advance

Is anything like this possible?

Of course. Regarding the code you posted, have you tried debugging it? Is the conditional evaluating to true when you expect it to? Are you getting any run-time errors? Does 'emptyGameObject' actually point to a valid game object?

Also, note that you can access the parent game object of a game object via 'transform.parent.gameObject' (note that this will most likely fail if there is no parent).