Skip to content

Fix platform dependent compilation for OSX#96

Merged
yasirkula merged 1 commit intoyasirkula:masterfrom
bclausdorff:fix_macos_conditional_compilation
Mar 31, 2024
Merged

Fix platform dependent compilation for OSX#96
yasirkula merged 1 commit intoyasirkula:masterfrom
bclausdorff:fix_macos_conditional_compilation

Conversation

@bclausdorff
Copy link
Copy Markdown
Contributor

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
Copy link
Copy Markdown
Contributor Author

Apologies.

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

image

@bclausdorff bclausdorff deleted the fix_macos_conditional_compilation branch March 25, 2024 20:07
@yasirkula
Copy link
Copy Markdown
Owner

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 bclausdorff restored the fix_macos_conditional_compilation branch March 26, 2024 17:27
@bclausdorff bclausdorff reopened this Mar 27, 2024
@bclausdorff
Copy link
Copy Markdown
Contributor Author

bclausdorff commented Mar 27, 2024

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

On macOS, we want the code blocks take effect in the Editor, regardless of the chosen build target. So in addition to `UNITY_STANDALONE_OSX`, we also have to check for `UNITY_EDITOR_OSX`.

And on Windows, we don't want these code blocks to take effect in the Editor, even though macOS has been selected as the build target. So we only should check for `UNITY_STANDALONE_OSX` when not running in the Editor.
@bclausdorff bclausdorff force-pushed the fix_macos_conditional_compilation branch from 6c18980 to de66d97 Compare March 27, 2024 19:56
@bclausdorff
Copy link
Copy Markdown
Contributor Author

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

@yasirkula
Copy link
Copy Markdown
Owner

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

@yasirkula yasirkula merged commit 07398a2 into yasirkula:master Mar 31, 2024
@bclausdorff bclausdorff deleted the fix_macos_conditional_compilation branch June 18, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants