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