There are plenty of tutorials in various languages to play sounds in Unity 3D, but there is not much tutorial about playing sound directly from the new UI Button (Unity 4.6 and above).
First, Create a Audio Source From the GameObject Menu.
Assign Audio Clip on it. Make sure you already drop the sound file in the asset folder. Unity3d support multiple sound format such as wav , ogg and mp3. Then uncheck the Play On Awake check box.
Goto Button GUI under Canvas tree menu, and click + button. Next drop the audio source into the Object source (see image above)
Select the Play Function and now you can try to run the scene and see its will play the sound when you click the button.
How to Play Sound on new Unity 4.6 Gui Button
Reviewed by Admin
on
6:40 PM
Rating:
No comments: