- Home /
de/activate audio listener via collision? (or click?)
Hi there, I've been playing with unity for awhile, but am only now starting to program. I'm not asking for a script, but recommendations as to what functions I should be using to make happen what I want to.
The current project (not really a project, more just space for me to F with) is this http://xaler.web44.net/ (click the picture)
I'd like to make it so that you could either hit the box (some sort of collision) or click with with the mouse to make the music pause, then hit/click it to make it play. I'd prefer if the music started out not playing.
So I guess what I want to know is, do I just put a script in the gameobject with the audioplayer? And what functions would control the play/pause part?
Let me know what you think, thank you.
-Sir Paddles of Loxely
So your asking if a game object haves a sound on it, how to do turn it on and off by clicking on it ?
Either that or by colliding with it. And I don't mean by using GUI.
Answer by DaveA · Jan 27, 2013 at 08:42 AM
Pretty much this: http://docs.unity3d.com/Documentation/ScriptReference/Collider.OnCollisionEnter.html and this
http://docs.unity3d.com/Documentation/ScriptReference/AudioSource.Stop.html or just audio.enabled = false;
Your answer
Follow this Question
Related Questions
A way to combine 2 or more objects to make 1? 1 Answer
Audio listener to mono then to left or right speaker? 2 Answers
HELP!!! My built game crashes when a trigger is hit 1 Answer
Audio on collision is not playing 1 Answer
audio on collision 1 Answer