Quantcast
Viewing all articles
Browse latest Browse all 103

How do i play mp3 files in Unity Standalone?

I am making a game in Unity in which the player can select music files in their hard drive to use them in-game. I use the WWW class to load the sound files, but this only works for OGG, WAV and Tracker files. I use the following code:

WWW www = new WWW ("file:///" + soundPath);
while(!www.isDone){
    yield return 0;
}
GetComponent<AudioSource> ().clip = www.GetAudioClip(false, true);

I want to play audio files in mp3 format, which is the most widely used format for music in general, but when i try to play them, this gets printed to the debug log:

Streaming of ‘mp3′ is not supported on this platform.

How can i easily achieve mp3 playback on desktop?


Viewing all articles
Browse latest Browse all 103

Trending Articles