yasirkula / UnitySimpleFileBrowser

A uGUI based runtime file browser for Unity 3D (draggable and resizable)
MIT License
874 stars 113 forks source link

Fix platform dependent compilation for OSX #96

Closed bclausdorff closed 8 months ago

bclausdorff commented 8 months ago

There are code blocks wrapped by UNITY_STANDALONE_OSX to only work on OSX. But to make them also work in the Unity Editor on macOS, a check for UNITY_EDITOR_OSX needs to be added as well.

1. Filter quick link section from too many macOS drives

Before

image

After

image

2. Documents quick link should lead into actual ~/Documents folder

Before

image

After

image

3. Add user folder to quick link section

image

bclausdorff commented 8 months ago

Apologies.

It works with UNITY_STANDALONE_OSX alone when one has set the platform to macOS in the Build Settings.

image

yasirkula commented 8 months ago

I think your fix is still valid because as you've demonstrated, the plugin doesn't work properly when target platform isn't set to macOS in OSX editor.

bclausdorff commented 8 months ago

You're right. The behaviour is unexpected in the Editor. Thank you. I'm reopening the PR. :)

So whether #if UNITY_STANDALONE_OSX is true depends only on which target platform is set in the Build Settings (regardless of which platform the Editor is running on).

Which means that it will also be true when setting macOS as the build target on a Windows machine. Which itself is leading to buggy Quick Links on Windows.

This behaviour already exists on the current main branch. I will adjust the PR to also fix these as well.

Mac Build Target on Windows

Before

01_editor_windows-platform_mac

After

02_editor_windows-platform_mac

Windows Build Target on Windows

Is unaffected of the changes and looks as expected.

editor_windows-platform_windows
bclausdorff commented 8 months ago

@yasirkula I squashed a fix for Windows into the existing commit. Please have another look. :)

yasirkula commented 8 months ago

Awesome! I got sick this week, hence the delay 😞