I can utilize a jpeg from a source file on drive using wwwtexture, but how do I allow
Unity to allow user to browse for a file on their hard drive. Just like they would from
a typical app.
Thx for the help!
Please provide more context - who is the end user here, and what setting? is this for a Webplayer, as standalone build, or an editor tool?
Here is free file browser using c# code C# File Browser in asset store or C# File Browser in mega.co.nz
This File Browser is easy to use. In my game this file browser with few modification is using for image uploader .
File -> Build Settings ->Player Settings
Inspector -> Other Settings -> Configuration -> Write Access ->External( sdcard)
If you want to browse image/video path from gallery on android, then you can use this plugin.
Answer by AngryAnt
Jan 11, 2010 at 01:40 PM
There is no built in file browser for the player, so you would need to roll your own using the .net frameworks classes for file system access. A while ago I wrote a UnityGUI one - it could probably use a lot of love, but it is a good starting point.
This of-course only works for stand-alones - not webplayers (security restricts access to the users file system). If you need to allow the user to upload files to your webplayer, you should go through HTML forms for that.
I've done that before and a good trick is to have your webplayer run in a frameset with a zero pixel tall data frame which you would use to communicate with the upload process. You can use Application.ExternalEval to add your upload form to the surrounding HTML.
Thanks for the info. I'm new to all this so it's a bit beyond my reach at the moment. Is there an easy .fla (flash) file on the web that will do what you describe, or is PHP the key to make it happen.
As far as I know you can't use flash for server-side scripting. Something like ASP/Perl or PHP as you suggest would be needed for that.
do u have a sample or tutorial on how to go about doing file browser for file system?
I have just made some experiments on user textures loading into the WebPlayer. See Them on my blog here:
Why not use WWWForm to upload the image? The example shows already how to send a screenshot out of Unity to the server: http://docs.unity3d.com/Documentation/ScriptReference/WWWForm.html
Answer by Stelimar
Jan 11, 2010 at 03:53 AM
In the editor, you can use EditorUtility.OpenFilePanel to show an window in which the user can select a file, and the path of the selected file is returned. You can then use that load the file or do whatever you want with it. I don't know of anything similar you can use in your actual application, but you could use a simple text field in which the user enters the name of the file they want to load. Creating a full-blown file-select dialog where the user can browser their hard-drive and external devices would be more difficult.
I tried the script found at your link called EditorUtility.OpenFilePanel a " Can't add script behaviour openfile. The script needs to derive from MonoBehaviour!"
was the result. Am I missing something?
Thx for our help!
I also tried putting the script in Assets/Editor and Unity reports back error.
Also, the script WILL need to be in the Assets/Editor folder.
Answer by maspi
Jan 08, 2012 at 01:49 PM
I'm working with UniFileBrowser. you wil get it in the Asset Store or directly from starscene It's easy to integrate and works perfectly for standalones.
if you want to change the layout, you have to invest a little time but it works.
Answer by petrucio
Oct 10, 2012 at 07:10 PM
There's also File Browser & Save/Load UI from the Asset Store:
You can use this nice plugin to load image/video from gallery
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
7 People are following this question.
The name 'Joystick' does not denote a valid type ('not found')
What is the maximum byte length of Application.ExternalCall? (and oh yea, it doesn't escape strings correctly)
How to check if loading from another level or game start?
Socket with webplayer stops when in background??
Is there a FileChooser available for GUI?