Load a folder of files defined by the user at runtime? Custom radio - unity3d

I am trying to create custom radio tracks in my Unity game, and I want the user to be able to place audio files in a directory like My Documents/My Games/Unity Game/Custom Sounds/ . Then I want Unity to put all audio clips from this folder into an array for me to use in my code. I have searched but cannot find anything about loading a file you don't know the exact path of, or how many there will be

From #Eddge:
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use file:// then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop

Related

Unity UniWebView how to show images from my Resources (Assets)

i have a few quick questions:
background:
i want to display a in-code generated html with UniWebView in my game. Mostly works nicely until i try to display local images (from my unity-resources)
the images are in my "Resources" folder (and used elsewhere in the project also)
my goal to support Android/iOS/Windows environments with the game
Q1: can i display images from "Resources"? this would be the best if i could
Q2: do i need to move all my assets into the "StreamingAssets" folder and access from there? if so, can "StreamingAssets" folder be under "Resources" folder? like this: "Resources/StreamingAssets"? If so please confirm that i can use them as unity resource for unity components AND also streamable assets for UniWebView in the same time?
thanks!
daniel

How to load assets dynamicaly in Unity3D?

What is the proper way to load external assets in Unity3D Webplayer?
My example consists of an empty scene and a button. I have to load an external asset into the scene when user clicks a button. Than i should assign scripts etc, but the question is - i can create an empty object with script, but how to load an external asset into it?
External asset is the file stored on the remote PC, accessible by http or any other protocol.
Unity has the WWW class for accessing data from certain protocols, most notably http like you said above.
http://docs.unity3d.com/Documentation/ScriptReference/WWW.html
If the object returns successfully you can access the data it downloaded. You can access the raw bytes it downloaded and treat the data however you need. Alternatively, you can access it as text or a texture if that is applicable in your situation.
You can have a look at AssetBundles:
https://unity3d.com/fr/learn/tutorials/topics/best-practices/assetbundle-fundamentals
Once the bundle is stored somewhere remotely you can download it using WWW.LoadFromCacheOrDownload and then instantiate specific objects from it.

Tag MP3 downloaded From Internet?

I am building an app with several podcasts. Each podcast gives the option to download the MP3 to the app. I have about 6 podcasts and would like to Tag each, so that when the archive view is clicked from each podcast, only archived files from that particular podcast show.
Is there someway that I can add a Tag or something to the downloaded mp3, and then in the archive, search only for mp3s with a tag related to that podcast?
BTW, I am using NSURLConnection to download each file
I think you may be looking at this in the wrong way.
Rather than tagging your downloaded files, you could set up a data structure to hold information about your files and use that to display your information.
For example. If I were doing this I would have a Core Data model that held information about the downloaded file, and tags, or sources, and I would store the path to that file in the database. That way, you can store whatever information you like about the downloaded file, and you can access it through it's path.

Storing Large Number Of audio resource

I'm working on a iphone application project in which, i have around 500(250mb) audio files.
When i got them from studio they were in wav format, I converted them to caf(35mb).
is there any other way/format i can compress them ?
dumping 500 audio files to iphone app resource will be good?
any suggestions?
In Storm Sim I did a folder reference for the audio samples with the files structured inside subfolders so I could keep them organized in a somewhat sane way.
Instead of using the standard get resource calls I just ask for the app's main bundle directory and the referenced folder is inside the main app folder with the appropriate subfolders under it.
Let me know if you need a code sample.

iPhone save game state

I'm implementing a save game feature to my game, so I'm looking for the best way to store the saved game.
Since I'm using C++ everywhere it's possible, I can't use NSKeyedArchiver to store the state of the game.
I am thinking in saving the state manually in a file, so I have a questions about that:
In which subfolder of apphome should I save that file? Looking into the iOS Programming Guide I didn't found a folder that perfeclty fit that need. Should I create a custom subfolder in Library or am I missing something?
Thanks in advance
Write the file into the Documents directory (NSDocumentDirectory). Thats the path to save your stuff, you can alter its content in any way by eg. adding subfolders for your save games or whatever.
DON'T save it inside the library folder!