Put WAV or MP3 in Assets folder.
Create an empty Game Object.
Drag the Audio file to the Game Object
If "Play on Awake", music will play automatically.
If not, using code:
use GameObject.Find . eg.: var obj:GameObject = GameObject.Find("music");
and then
obj.audio.Play(); // audio is built-in, if audio component exists. else null
Video: It is a PRO / Advanced feature. only for Unity Pro license.
Create an empty Game Object.
Drag the Audio file to the Game Object
If "Play on Awake", music will play automatically.
If not, using code:
use GameObject.Find . eg.: var obj:GameObject = GameObject.Find("music");
and then
obj.audio.Play(); // audio is built-in, if audio component exists. else null
Video: It is a PRO / Advanced feature. only for Unity Pro license.
No comments:
Post a Comment