• 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
0
Question by gdennis · Dec 27, 2014 at 04:39 PM · jsonparsingeditorutility

OpenFilePanel alternative

Hello, I am in need of opening a file from the explorer in my Unity project.

The code I use now is the following:

 string newFilePath = EditorUtility.OpenFilePanel("Select JSON file", Application.streamingAssetsPath, "json");
                 
 //Debug.Log ("Game is loaded with this level: " + newFilePath);
 if (newFilePath.Length != 0) {
     JSONLines = "";
     filePath = newFilePath;
     StreamReader reader = new StreamReader(filePath);
     while ((line = reader.ReadLine()) != null)
     {
             JSONLines += line;
     }


This obviously does not translate to a standalone build because it is EditorUtility.

Is there a way to make this happen in a standalone build (let the user select a JSON file and return the content as a string)?

PS: I have looked at the UniFileBrowser offered by user Eric but if it is not too much of a hassle I would rather have it non-paying.

PS2: I took a look at this http://wiki.unity3d.com/index.php?title=ImprovedFileBrowser but I am completely lost in how to get this working (if it even can do what I want).

Thanks a lot for the help in advance, Dennis

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 nathanthesnooper · Sep 10, 2016 at 09:57 PM 0
Share

We seriously need an answer to this... Is there no way? I've been searching for hours

avatar image doublemax nathanthesnooper · Sep 10, 2016 at 11:04 PM 0
Share

This one from the assert store doesn't look very nice, but it works: https://www.assetstore.unity3d.com/en/#!/content/18308

The ImprovedFileBrowser from the link above needs some work. Displaying the files works, but you can't select any file.

avatar image Eric5h5 nathanthesnooper · Sep 10, 2016 at 11:41 PM 0
Share

The options are: buy a paid asset with support, create your own, or try to make do with free stuff. There isn't any built-in run-time equivalent of OpenFilePanel.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by gkngkc · Jan 11, 2017 at 09:00 AM

I wrote similar thing for one of my projects.

https://github.com/gkngkc/UnityStandaloneFileBrowser

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 dmts17 · Jan 03, 2018 at 12:00 AM 0
Share

You're a life savior @gkngkc !!!! This was exactly what i was trying to find for weeks! Really amazing

avatar image fafase · Jan 03, 2018 at 11:36 AM 0
Share

It works fine when building in Editor but using Cloud build, it will fail to find the Drawing.dll.

avatar image gkngkc fafase · Jan 03, 2018 at 11:46 AM 0
Share

Hmm, i used it in a cloud build project and worked fine for me. Not sure what causing this. Usually Drawing.dll error caused by API Compatibility Level selection.

avatar image fafase gkngkc · Jan 03, 2018 at 01:01 PM 0
Share

I posted else where and someone had a similar issue, not related to your plugin but to missing Drawing.dll in cloud build. Not sure then as you seem to have it running.

Show more comments

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

forcing unload a file after error 0 Answers

Missing Method Exception when trying to access EditorJsonUtility class methods 4 Answers

Looking for Code that will Read JSON files (C# code) 2 Answers

Loading JSON into JSON issue,JSON file inside JSON problem 0 Answers

Parse Json Response through Dictionary object 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges