- Home /
The question is answered, right answer was accepted
Play personal music from a specific folder
Hello !
I would like to randomly play some music the player previously copied in folder "Music" contained in the Data folder of the build. I have no clue how to do that ...
The only things I know (or I suppose are correct) are that I need "Application.dataPath" to get the Data folder created by the build (for windows), add the "/Music" string to get the entire path, maybe load the musics with "Resources.LoadAll("*.mp3").
Depending on the number of files, I'll loop on them and add an AudioSource component, then put the music as the clip of this component (I don't have any clue how to do this...)
Can someone help me a little bit with this please ?
EDIT : nobody can help me ?
Answer by Graham-Dunnett · Jun 04, 2013 at 09:13 PM
Resources.LoadAll
cannot load arbitrary files. This API is used to load data that the editor has created when you make a build. The WWW can fetch data, and you can generate an AudioClip
from this fetched data using WWW.GetAudioClip()
. This is documented as needing audio files in Ogg or Wav format, though.
Follow this Question
Related Questions
Delete Folder? 2 Answers
Game Folder Question 2 Answers
project folders expand arrow. where is it ? 2 Answers
Custom editor script for folders? 1 Answer
Meta files incorrectly changing contents on other machines 0 Answers