Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
6
Question by peter · Jan 11, 2010 at 02:30 AM · webplayerfile-io

How do I let the user select a local file for my application to use?

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!

P

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image duck ♦♦ · Jan 11, 2010 at 11:01 AM 0
Share

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?

avatar image LijuDeveloper · Jan 06, 2015 at 05:37 AM 1
Share

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 .

For Android

File -> Build Settings ->Player Settings

Inspector -> Other Settings -> Configuration -> Write Access ->External( sdcard)

avatar image DeveshPandey · Feb 11, 2015 at 03:16 PM 0
Share

If you want to browse image/video path from gallery on android, then you can use this plugin.

https://www.assetstore.unity3d.com/en/#!/content/28597

5 Replies

· Add your reply
  • Sort: 
avatar image
9

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.

The trick is then to have this form target the dataframe with your receiving server-side script - overseeing the file upload operation. Once the upload is completed, your server-side script (now outputting to the hidden dataframe) should output javascript to hide the HTML form and send the URL of the uploaded file to the webplayer.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image peter · Jan 11, 2010 at 08:51 PM 0
Share

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.

avatar image AngryAnt ♦♦ · Jan 12, 2010 at 09:03 AM 0
Share

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.

avatar image R-GiGgS84 · Aug 10, 2011 at 07:09 AM 0
Share

hi AngryAnt,

do u have a sample or tutorial on how to go about doing file browser for file system?

avatar image tomekkie2 · Jan 08, 2012 at 02:05 PM 0
Share

I have just made some experiments on user textures loading into the WebPlayer. See Them on my blog here: http://virtualplayground.d2.pl/WP/?p=254

avatar image marsbear · Aug 15, 2012 at 07:30 PM 0
Share

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

avatar image
4

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image peter · Jan 11, 2010 at 05:29 AM 0
Share

I tried the script found at your link called EditorUtility.OpenFilePanel a " Can't add script behaviour openfile. The script needs to derive from $$anonymous$$onoBehaviour!" 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.

avatar image Stelimar · Jan 11, 2010 at 11:19 PM 0
Share

It means exactly what it says, the class your trying to use the function in has to be a child of the $$anonymous$$onoBehaviour class. If you're using JavaScript and don't use the class declaration, that's the default. But if you are using the class declaration, or you're using C# or Boo, you'll have to specify that it inherits from $$anonymous$$onoBehaviour.

Also, the script WILL need to be in the Assets/Editor folder.

avatar image
2

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by petrucio · Oct 10, 2012 at 07:10 PM

There's also File Browser & Save/Load UI from the Asset Store:

http://u3d.as/content/pigasus-games/file-browser-save-load-ui/3rU

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DeveshPandey · Feb 18, 2015 at 08:41 AM 0
Share

You can use this nice plugin to load image/video from gallery

https://www.assetstore.unity3d.com/en/#!/content/28597

avatar image
0

Answer by cherryinatree · Jun 17, 2019 at 11:15 AM

This asset in the unity store is what you're looking for. You can have them pick files from their computer

https://assetstore.unity.com/packages/tools/gui/runtime-file-browser-113006,This asset in the unity store is what you are looking for.

https://assetstore.unity.com/packages/tools/gui/runtime-file-browser-113006

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Setting Scroll View Width GUILayout 1 Answer

Optimization Techniques? 2 Answers

API Compatibility Level 2 Answers

WebPlayer can't handle Unity GUI?! 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges