Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

loading audios from outside of unity

Discussion in 'Editor & General Support' started by AliAzin, Dec 21, 2009.

  1. AliAzin

    AliAzin

    Joined:
    Jun 25, 2009
    Posts:
    51
    Is it possible to load audio files directly from outside of unity without importing them in the editor?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Yeah, WWW class and file:// protocol
    but they need to be in a supported format for playback then too, not just a supported for import, which basically means wav and ogg on the desktop as far as I remember
     
  3. AliAzin

    AliAzin

    Joined:
    Jun 25, 2009
    Posts:
    51
    Thank's for your quick reply dreamora
     
  4. mytoltoly

    mytoltoly

    Joined:
    Apr 23, 2009
    Posts:
    41
    ogg play sound when app use www(file\\..) but wav doen't..

    Code (csharp):
    1. private AudioClip loadFileAsAudio(String file) {
    2.         www=null;
    3.         if (!file.StartsWith("file://"))
    4.         {
    5.             file = "file://" + file;
    6.         }
    7.        
    8.         www = new WWW(file);
    9.         if (www == null)
    10.             return null;
    11.  
    12.         return [url]www.audioClip[/url] ;
    13.     }
    14.  
    15. could you tell me how to play wav file that located outside unity?
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    The WWW class can only load Ogg Vorbis files, according to the docs.
     
  6. markharkness

    markharkness

    Unity Technologies

    Joined:
    Nov 2, 2010
    Posts:
    176
    This can now be done on the following file types as of unity 3.3.0f3.

    wav
    ogg
    xm
    s3m
    mod
    it
     
  7. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    595
    On 3.1 it was possible to stream .ogg files into iOS devices.

    But on 3.3 this is not possible. Is it going to be supported back in 3.4?