I have been looking all day to find tutorials on how to make a script when the scene launches the sound automatically plays. Also on how to trigger sounds on collision. I know that I need to use the Awake function on the 1st problem ,but I don’t know how play the sound on script and loop it as long as the scene is awake. I can’t seem to find tutorials and I am so new in coding in unity. Any help or guidance is much appreciated. Thank you all!
Thank you for the response. I get your point and I see the structure of the script. My only problem now is doing the actual statement. Could I kindly ask for a complete script that do both problems? Thank you.
Example:
var myClip | AudioClip;
Awake()
{ the actual statement which I am clueless to construct with loop and play
}
Regarding the first problem, you don’t need to implement the Awake() function at all. Just check the ‘loop’ and ‘play on awake’ boxes in the inspector for the AudioSource component, and that should take care of it.
And if you want the music to be the same loudness then make sure your music is NOT a 3D sound. To do that, select the music in the assets window, and uncheck to is a 3D sound box and press apply!