gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.01k stars 317 forks source link

Opening file browser broken on mac, missing dll #24

Closed GafferSystems closed 6 years ago

GafferSystems commented 6 years ago

Unity 2017.1.1f1

  1. Started new Unity3d project.
  2. Switched build settings to Mac OS X x86.
  3. Imported by doubleclicking StandaloneFileBrowser.unitypackage from readme.
  4. Opened CanvasSampleScene.
  5. Clicked "Open File - Image".

Got: DllNotFoundException: StandaloneFileBrowser error log

GafferSystems commented 6 years ago

@gkngkc Any news on this? Seems to be broken for mac on newer versions of Unity all together.

gkngkc commented 6 years ago

Hi,

If i understand correctly, you're running editor with mac build settings on a windows machine. If this is the case, it won't work because of the plugin selection code. You can use EDITOR compile flags to select correct plugin.

GafferSystems commented 6 years ago

Hi again @gkngkc ! We have now ran it on a Mac, standalone outside the editor, and it's still not working, we get a different error message here though.

When we request to open file dialog it opens as expected. It let's us select a png or jpg, but when we try to use it, it spins for a while and return an error, followed by closing without returning the selected image.

screen shot 2017-12-14 at 21 02 32

Here is my code that works for Win but not Mac: public void uploadImage() { paths = StandaloneFileBrowser.OpenFilePanel("Choose image", "", "", false); WWW www = new WWW ("File://" + paths[0]); imagePlane.GetComponent<Renderer> ().material.mainTexture = www.texture; }

gkngkc commented 6 years ago

It's probably because of WWW. You can check these two things,

GafferSystems commented 6 years ago

@gkngkc I tried once again on windows and mac. On Windows it works perfectly, and the path[0] returns: "C:\Users\Myname\Desktop\image.png

On mac it crashes with the UriFormatException, and path[0] returns: file:///Users/Myname/Desktop/image.png

GafferSystems commented 6 years ago

Seems like adding file:// to the www was the issue, it works for windows but not mac if its' added. Removing it from the line, so it becomes WWW www = new WWW (paths[0]); Fixes everything. Thanks for your time @gkngkc and hope this can help others encountering the same issue.