Search Unity

WWW Class doesn't work under MacOSX build

Discussion in 'Scripting' started by PeerPressure, Oct 31, 2014.

  1. PeerPressure

    PeerPressure

    Joined:
    Apr 15, 2014
    Posts:
    14
    Dear Unity community,

    My music team makes the soundtracks for my game, and they need MacOSX build, so then don't have to delve into the code, and can load their own song. I use the WWW function to load the externa WAV's.

    It works perfectly under Windows build, but it doesn't seem to work in the mac build. How to fix this?
    this is my code:

    public AudioClip audio1;
    public AudioClip audio2;
    public AudioClip audio3;

    void Awake(){

    var www = new WWW ("file://" + Application.dataPath.Substring (0, Application.dataPath.LastIndexOf ("/")) + "/music1.wav");

    var www2 = new WWW ("file://" + Application.dataPath.Substring (0, Application.dataPath.LastIndexOf ("/")) + "/music2.wav");

    var www3 = new WWW ("file://" + Application.dataPath.Substring (0, Application.dataPath.LastIndexOf ("/")) + "/music3.wav");


    audio1 = www.GetAudioClip(false,false);
    audio2 = www2.GetAudioClip(false,false);
    audio3 = www3.GetAudioClip(false,false);

    }
     
  2. cowtrix

    cowtrix

    Joined:
    Oct 23, 2012
    Posts:
    322
    Have you taken into account that `Application.dataPath` returns different values depending on the platform?