Hey, I was wondering as opposed to all the other means of loading AudioClips like with the WWW thing; is there a way to load it from assets within the project? Like something with resources.Load and putting that into an already existing audio source?
Can no one help with this?
I saw this page, looks like it’s possible if you have an audiosource on the object and you cast it from resources as an audioclip.
You load it like this:
var clip = Resources.Load("MySoundFile") as AudioClip;
Note that it needs to be in a folder named “Resources” to load it this way.
then if you have an audio source, play it in either of these ways:
audioSource.PlayOneShot(clip); //if you just want to play it once but not change the clip assigned to the source
audioSource.clip = clip; //if you want to assign the clip so that every call to play calls that clip
audioSource.Play();