- Home /
Loading an asset into the game post-build
I need to use an absolute path such as "C:/Users/Blah/Documents/musicfile.mp3" to load in a song at runtime. The music file will then need to be attached to an audio source on an object. What can I use to do this?
Resources.LoadAssetAtPath says that it only works in the editor, so I'm not so sure that will work. Also, using WWW will not work with mp3s on the PC, only on the iOS.
If I need to go into any more detail, please ask.
If you know the file at design-time and you have Unity Pro, you could use an asset bundle.
Otherwise could you convert it to OGG format?
Asset Bundles only work if the person running the program has unity pro installed as well. Right now I'm looking into doing something with converting it to OGG at runtime with F$$anonymous$$OD. I'll have to look more when I'm off of work though.