From 43ecdbe34a68664420af9f43381463c9b734a67d Mon Sep 17 00:00:00 2001 From: Mehmet Soyturk Date: Fri, 28 Nov 2025 15:38:49 +0300 Subject: [PATCH] Fixed cross compilation from Linux Example: build happens from Linux CI server, with another platform (like WebGL) as target. CesiumForUnity package is installed. The build happens by from the Unity Editor on Linux. When the editor is opened, it does two things: * loads the project and ensures that the editor loads the needed resources/scripts, compiles the needed scripts * switches to the target platform to make the build, starts the build, etc Cesium does not support building on Linux: the native runtime is missing for Linux, and the generated code for from Reinterop does not generate any code for Linux. However, when loading the Unity Editor on Linux, it tries to compile Cesium scripts, which fail because of missing Reinterop bindings. When that fails, the cross compilation to WebGL does not start at all. Cesium .asmdef files don't declare explicit support for Linux, which is ok. However, they declare support for "Editor", which also matches the Editor on Linux. With this commit, we ensure that Cesium scripts won't be loaded for the Editor on Linux either. This way, projects can be loaded on Linux and builds for a different target platform successfully. --- Editor/CesiumEditor.asmdef | 4 +++- EditorTests/CesiumEditorTests.asmdef | 3 ++- Runtime/CesiumRuntime.asmdef | 4 +++- Tests/CesiumTests.asmdef | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Editor/CesiumEditor.asmdef b/Editor/CesiumEditor.asmdef index b3643781..24bc34c0 100644 --- a/Editor/CesiumEditor.asmdef +++ b/Editor/CesiumEditor.asmdef @@ -14,7 +14,9 @@ "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [], + "defineConstraints": [ + "!UNITY_EDITOR_LINUX" + ], "versionDefines": [ { "name": "com.unity.splines", diff --git a/EditorTests/CesiumEditorTests.asmdef b/EditorTests/CesiumEditorTests.asmdef index ef321288..e5890cfb 100644 --- a/EditorTests/CesiumEditorTests.asmdef +++ b/EditorTests/CesiumEditorTests.asmdef @@ -18,7 +18,8 @@ ], "autoReferenced": false, "defineConstraints": [ - "UNITY_INCLUDE_TESTS" + "UNITY_INCLUDE_TESTS", + "!UNITY_EDITOR_LINUX" ], "versionDefines": [], "noEngineReferences": false diff --git a/Runtime/CesiumRuntime.asmdef b/Runtime/CesiumRuntime.asmdef index 225d4b8d..9437710c 100644 --- a/Runtime/CesiumRuntime.asmdef +++ b/Runtime/CesiumRuntime.asmdef @@ -20,7 +20,9 @@ "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [], + "defineConstraints": [ + "!UNITY_EDITOR_LINUX" + ], "versionDefines": [ { "name": "com.unity.splines", diff --git a/Tests/CesiumTests.asmdef b/Tests/CesiumTests.asmdef index 32938bd7..4bbec75d 100644 --- a/Tests/CesiumTests.asmdef +++ b/Tests/CesiumTests.asmdef @@ -17,7 +17,8 @@ ], "autoReferenced": false, "defineConstraints": [ - "UNITY_INCLUDE_TESTS" + "UNITY_INCLUDE_TESTS", + "!UNITY_EDITOR_LINUX" ], "versionDefines": [ {