Search Unity

What's the replacement for WWW.audioClip?

Discussion in 'Scripting' started by JoeStrout, Jun 15, 2017.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    According to the docs, WWW.audioClip is obsolete and removed in 5.6.1p1.

    So what's the replacement? How do I create an AudioClip from an Ogg, MP3, WAV, XM, IT, MOD or S3M file now?

    (My real goal is simply to load sounds from WAV files at runtime, and not to sink a bunch of time into writing my own WAV parser. So if there is no drop-in replacement for WWW.audioClip, then pointers to scripts online or low-cost assets that get the job done would also be appreciated.)

    Thanks,
    - Joe
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Ryiah and JoeStrout like this.
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Oh yeah. Duh. :) I knew that but for some reason it didn't come to mind this morning.

    For posterity, the (more or less) direct equivalent of WWW.audioClip would be UnityWebRequest.GetAudioClip.

    Awesome. Thanks for the quick response!
     
  4. justdizzy

    justdizzy

    Joined:
    Mar 8, 2016
    Posts:
    89
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    (To be clear, I like that you pointed it out... I don't much like the ever-changing-for-no-good-reason API. ;) )
     
    justdizzy likes this.