Hello,
I have an interesting question. What if I finish publishing a game in Unity, and I would like to run it from a server and at the STARTING of the game, it asks for an ‘input folder’ from your local disk drive that contains all the sounds that should go into the sound clips of the game, all the textures that should go into the materials of the game, and ‘other resources’ that you can use (all from the folder you send it)? That way, when you send it a different folder, the ‘gaming experience’ changes. My goal is to load all the sounds and textures into two separate Lists after the user supplies the folder, and then the game runs after everything all loads.
Somebody a long time ago said that Asset Bundles would do this, but I was never able to figure out HOW Asset Bundles met up to exactly what it was I was trying to do, or if this person had fully understood what it was I was trying to do.
The Unity UI forum area isn’t the best area for this question. It should probably be in Scripting.
When you create an Asset Bundle, you can put files such as audio clips in it. The Asset Bundle is a separate file (kind of like a zip file) that exists outside of your Unity game build. You can put the Asset Bundle on a server or store it on the player’s local disk. Your game can then load the Asset Bundle, and then you can load assets from it using AssetBundle.LoadAsset, which is similar to Resources.Load.
If you don’t want to use Asset Bundles, you can load individual audio files from a server or local disk using the WWW class.
Thank you, but what if I wanted to make it so that the user would send the game a folder (with the files already IN it), so that the user wouldn’t have to do anything ‘complicated’ (like create an asset bundle) before uploading it into the game? I wish there was a widget that I could download into my program that would ask users for a regular folder to read from (for extra resource purposes) right before the game starts.
In that case, don’t use Asset Bundles. Ask the player to specify a folder (or hard-code the folder path and tell the player where to put audio files), and use WWW to load audio files from that folder.
That may be a good idea, but what if I want to run the game on a browser from a server, and I want the user to give the program permission to read from a local folder on a local drive? I know I can use “file:///C:/…” with WWW (to get files on a local drive FROM a local drive), but I don’t think I’d be able to do that from a program that sits on a server.
You could try and be creative. If you want to allow a user to browse for a file for use in a Web Player, you will have to write some stuff in the HTML page… JavaScript most likely, that talks with the Web Player app on the same HTML page. As you might have guessed, the Web Player cant directly show a Open File dialog to for the user to browse for a file and upload directly… But, a HTML page in your browser Can.
Don’t ask me exactly How to do it… not really sure, just allot of educated guesses on my part.