- Home /
Question by
maspi · May 08, 2014 at 08:42 PM ·
saveloading fileaudio files
Download and save .ogg - Files
Hi
I'm downloading .ogg files from a folder on my web account using www - class. Is there a way to save the files onto disc. Theres no need of converting, manipulating or streaming the files, just saving for later use.
Comment
Best Answer
Answer by maspi · May 09, 2014 at 07:15 PM
Thank you Jonas
With your help I got the following solution, wich seems to work fine. For WIN we have to change / to ...
var fileStream : FileStream;
//creating a folder for the Files
var pathToAudioData : String = "ThePathWithFolderName";
if (!Directory.Exists (pathToAudioData)){
Directory.CreateDirectory (pathToAudioData);
}
var url: String = "http://www.TheURL.ch";
var request : WWW = new WWW (url);
yield request;
File.WriteAllBytes(pathToAudioData+"/"+"xy.ogg", request.bytes);
Answer by jonas-echterhoff · May 09, 2014 at 12:50 PM
You should be able to use WWW.bytes to get the data, and write that to a file using something like File.WriteAllBytes.
Your answer
Follow this Question
Related Questions
can gameobjects be stored as static? 1 Answer
UnitySerializer Only Saving one Game Problem 0 Answers
Saving lots of objects 1 Answer
Saving and loading data from file 0 Answers