Tom_Lee
September 4, 2023, 4:17am
1
Hello.
I failed Cesium for Unity v1.6.1 build w/Unity 2021.3.10.f1. please help!
build environment.
Unity: 2021.3.10.f1
OS: Windows 10 Home
CPU: 12th Gen Intel(R) Core™ i9-12900K 3.20 GHz
RAM: 64.0GB
I succeeded build for v1.4.0 before. I followed guide below.
# Overview
This is a summary of the setup and workflows for developers who want to modify the Cesium for Unity plugin. If you just want to use Cesium for Unity in your own applications, see the main [README](../README.md).
## :computer: Building Cesium for Unity
### Prerequisites
* CMake v3.18 or later (the latest version is recommended)
* [.NET SDK v6.0 or later](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
* If you're using Visual Studio, you need Visual Studio 2022.
* Unity 2021.3+ (the latest version of the Unity 2021.3 LTS release is recommended)
* On Windows, support for long file paths must be enabled, or you are likely to see build errors. See [Maximum Path Length Limitation](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later).
* For best JPEG-decoding performance, you must have [nasm](https://www.nasm.us/) installed so that CMake can find it. Everything will work fine without it, just slower.
The built Cesium for Unity Assembly will run on much older versions of .NET, including the version of Mono included in Unity. However, these very recent versions are required for the C#<->C++ interop code generator (Reinterop).
To make sure things are set up correctly, open a command-prompt (PowerShell is a good choice on Windows) and run:
* `dotnet --version` and verify that it reports 6.0 or later
This file has been truncated. show original
please check the partial log of build.
0.1 kb 0.0% Packages/com.unity.mathematics/Unity.Mathematics/Noise/noise2D.cs
0.1 kb 0.0% Packages/com.unity.mathematics/Unity.Mathematics/Noise/common.cs
0.1 kb 0.0% Packages/com.unity.mathematics/Unity.Mathematics/Geometry/Plane.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Utilities/Observables/Observer.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Utilities/FourCC.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/OpenVR.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/Oculus.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/GoogleVR.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Plugins/EnhancedTouch/Touch.cs
0.1 kb 0.0% Packages/com.unity.inputsystem/InputSystem/Devices/Haptics/IHaptics.cs
0.1 kb 0.0% Packages/com.unity.ugui/Runtime/UI/Core/IMask.cs
0.1 kb 0.0% Packages/com.unity.timeline/Runtime/Events/IMarker.cs
0.1 kb 0.0% Packages/com.unity.timeline/Runtime/ClipCaps.cs
0.1 kb 0.0% Packages/com.unity.mathematics/Unity.Mathematics/half.cs
-------------------------------------------------------------------------------
Unloading 2 Unused Serialized files (Serialized files now loaded: 0)
Unloading 1384 unused Assets / (2.4 MB). Loaded Objects now: 5357.
Memory consumption went from 123.7 MB to 121.4 MB.
Total: 6.260500 ms (FindLiveObjects: 0.588500 ms CreateObjectMapping: 0.185500 ms MarkObjects: 3.956100 ms DeleteObjects: 1.529400 ms)
DisplayProgressNotification: Build Successful
Build Finished, Result: Success.
Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
Loaded scene 'Temp/__Backupscenes/0.backup'
Deserialize: 0.318 ms
Integration: 23.334 ms
Integration of assets: 0.001 ms
Thread Wait Time: 0.008 ms
Total Operation Time: 23.661 ms
Unloading 0 unused Assets / (0 B). Loaded Objects now: 5348.
Memory consumption went from 120.6 MB to 120.6 MB.
Total: 4.241600 ms (FindLiveObjects: 0.256100 ms CreateObjectMapping: 0.145500 ms MarkObjects: 3.821700 ms DeleteObjects: 0.017300 ms)
Aborting batchmode due to failure:
executeMethod method CesiumForUnity.BuildCesiumForUnity.CompileForUWPAndExit threw exception.
Aborting batchmode due to failure:
executeMethod method CesiumForUnity.BuildCesiumForUnity.CompileForUWPAndExit threw exception.
Exception: BuildPlayer failed:
Unhandled exception. System.Exception: An error (code 1) occurred while executing:
C:\Program Files\Unity\Hub\Editor\2021.3.10f1\Editor\Unity.exe -batchmode -nographics -projectPath C:\cesium\CesiumForUnityBuildProject -buildTarget WindowsStoreApps -executeMethod CesiumForUnity.BuildCesiumForUnity.CompileForUWPAndExit -logFile C:\Users\USER\AppData\Local\Temp\tmp44AB.tmp
at Build.Unity.Run(IEnumerable`1 args) in C:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity\Build~\Unity.cs:line 81
at Build.Package.Run() in C:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity\Build~\Package.cs:line 149
at Build.Program.Main(String[] args) in C:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity\Build~\Program.cs:line 10
I added module for Universal Windows Platform (UWP) FYI.
The actual error probably occurred earlier in the log. My best guess is that you’re missing the Visual Studio components necessary to build for UWP.
If you don’t need UWP support, you could also just remove that part of the Package.cs code.
1 Like
Tom_Lee
September 4, 2023, 4:50am
3
I just remove the part in Package.cs and build succeeded. thank you!
I wonder if this is for Holo lens build.
commit b3b73d38f497c158be235535edcd19670ce8c8f8
Author: Kevin Ring <kevin@kotachrome.com>
Date: Fri Aug 4 21:51:12 2023 +1000
Add UWP build to CI.
diff --git a/Build~/Package.cs b/Build~/Package.cs
index 75bc1c8..f009ae3 100644
--- a/Build~/Package.cs
+++ b/Build~/Package.cs
@@ -144,6 +144,23 @@ namespace Build
if (OperatingSystem.IsWindows())
{
+ // TODO: we're currently only building for UWP on Windows. This should be an option, or a separate build command.
+ Console.WriteLine("**** Compiling for Universal Windows Platform Player");
+ unity.Run(new[]
+ {
+ "-batchmode",
+ "-nographics",
+ "-projectPath",
+ Utility.ProjectRoot,
+ "-buildTarget",
+ "WindowsStoreApps",
+ "-executeMethod",
+ "CesiumForUnity.BuildCesiumForUnity.CompileForUWPAndExit"
+ });
+
+ Console.WriteLine("**** Adding generated files (for the UWP Player) to the package");
+ AddGeneratedFiles("!UNITY_EDITOR && UNITY_WSA", generatedRuntimePath, Path.Combine(outputPackagePath, "Runtime", "generated"));
+
Console.WriteLine("**** Compiling for Windows Player");
unity.Run(new[]
{
diff --git a/Editor/BuildCesiumForUnity.cs b/Editor/BuildCesiumForUnity.cs
index 1826292..8c7f9d6 100644
--- a/Editor/BuildCesiumForUnity.cs
Yep, as mentioned in the 1.6.0 changelog, the main reason we added UWP support is for Holo Lens 2.
1 Like
Tom_Lee
September 4, 2023, 6:10am
5
and also… I succeeded build for UWP too. I installed those below.
for Unity
Universal Windows Platform Build Support
Windows Build Support (IL2CPP)
for Visual Studio 2022
Universal Windows Platform development.
C++ (v143) Universal Windows Platform
C++ (v142) Universal Windows Platform
C++ (v141) Universal Windows Platform
Windows 11 SDK(10.0.22621.0)
Windows 10 SDK(10.0.19041.0)
Windows 10 SDK(10.0.18362.0)
for those who facing this situation. this info might be helpful.
1 Like