It looks like you're new here. If you want to get involved, click one of these buttons!
Hi and I am a 14 year old starter Game Developer. I just wanted to know what is the simplest way to play audio through script.. Thankyou!!!
Add a component: AudioSource to your current camera gameobject. Drag a sound/audio/music clip to it, and it will play upon scene start. Various options will be available to check/uncheck, such as "Loop" and more.
You can also choose not to play on scene start, and activate it with the code here: https://docs.unity3d.com/ScriptReference/AudioSource.Play.html
Keep on Creating!
Justin of JustinTime Studios (http://unity3d.expert)
Just use AudioSource.Play(); (replace AudioSource with a reference to an Audio Source Component)
public AudioSource mySound;