-
Notifications
You must be signed in to change notification settings - Fork 69
Gate the native engine on the host OS, not the active build target #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,11 +29,14 @@ internal sealed class EngineProcess : IDisposable | |
| /// <param name="logger"></param> | ||
| public EngineProcess(Engine engine, IWebBrowserLogger logger) | ||
| { | ||
| #if UNITY_STANDALONE_WIN | ||
| //Host-OS gate, matching WebBrowserUtils.GetRunningPlatform(). Without the editor | ||
| //defines processHandle stayed null in an Editor targeting a non-Standalone platform | ||
| //and every member that forwards to it threw a NullReferenceException. | ||
| #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN | ||
| processHandle = new WindowProcess(); | ||
| #elif UNITY_STANDALONE_LINUX | ||
| #elif UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX | ||
| processHandle = new LinuxProcess(logger); | ||
| #elif UNITY_STANDALONE_OSX | ||
| #elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX | ||
|
Comment on lines
+35
to
+39
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A more better way would be to check the editor platform first, then check the target platform only if the build is not an editor. That way if someone is using Linux editor with the target set to Windows, it will start the Linux process in editor. #if UNITY_EDITOR_WIN || (!UNITY_EDITOR && UNITY_STANDALONE_WIN)
processHandle = new WindowProcess();
#elif UNITY_EDITOR_LINUX || (!UNITY_EDITOR && UNITY_STANDALONE_LINUX)
processHandle = new LinuxProcess(logger);
#elif UNITY_EDITOR_OSX || (!UNITY_EDITOR && UNITY_STANDALONE_OSX)
processHandle = new MacOsProcess();
#endif |
||
| processHandle = new MacOsProcess(); | ||
| #endif | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,11 +140,17 @@ public static bool GetScreenPointToLocalPositionDeltaOnImage(Graphic graphic, Ve | |
| /// <returns></returns> | ||
| public static Platform GetRunningPlatform() | ||
| { | ||
| #if UNITY_STANDALONE_WIN | ||
| //Gated on the HOST OS, not the active build target. The engine is a native child | ||
| //process of the running Unity process, so in the Editor the platform that matters is | ||
| //the one the Editor itself runs on - a Windows Editor targeting WebGL/Android/console | ||
| //still has to launch the Windows engine. Keying this off UNITY_STANDALONE_* alone made | ||
| //this throw in any Editor whose build target was not Standalone, which stopped UWB | ||
| //being usable in the Editor for those projects at all. | ||
| #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN | ||
| return Platform.Windows64; | ||
| #elif UNITY_STANDALONE_LINUX | ||
| #elif UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX | ||
| return Platform.Linux64; | ||
| #elif UNITY_STANDALONE_OSX | ||
| #elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX | ||
|
Comment on lines
+149
to
+153
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as comment on EngineProcess. |
||
| return System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == System.Runtime.InteropServices.Architecture.Arm64 ? Platform.MacOSArm64 : Platform.MacOS; | ||
| #else | ||
| throw new PlatformNotSupportedException(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as comment on EngineProcess.