Building Cesium for Unity performance issue


We built a Cesium for Unity plugin using source code from github, followed this document, machine prerequisite:

  • dotnet --version: 6.0.408
  • cmake version: 3.26.4
  • Visual Studio 2022
  • Unity 2021.3.26
  • Enabled Long Paths in Windows 10
  • nasm installed
  • rebooted after all installation complete.

We build for the editor, inside a unity-samples project cloned from git recursively.
But unfortunately the performance tanks once the 3D model is loaded (raster image running smooth) the machine CPU usage is 90%-100% and the game view average around 3-5fps when moving.
Any idea what could be the source for the problem?

Following link has the command output:


Looks like you’ve done a Debug build of the native code. Release or RelWithDebInfo usually runs much faster.

1 Like

Thanks Kevin, that was the issue, RelWithDebInfo works smoothly.
Now we successfully built the project using the command line
dotnet run --project Build~
The CesiumForUnityBuildProject folder is nowhere to be found.
Is there a specific path for the build process?

CesiumForUnityBuildProject is the name of the Unity project that we use to host the plugin when we’re building it on our CI system. Yours may be different. The build process should produce a “.tgz” file in the root directory of your project, whatever it’s called.

Thanks for clarifying that, it seems like the process actually failed with an exception related to Android. In our sample project the target is set to PC/Windows machine.
What would you suggest skip the build process from android to PC? or is it a mandatory operation?
Attaching the end log output by the build command for more info:

Aborting batchmode due to failure:
executeMethod method CesiumForUnity.BuildCesiumForUnity.CompileForAndroidAndExit threw exception.

Memory consumption went from 175.0 MB to 175.0 MB.

Aborting batchmode due to failure:
executeMethod method CesiumForUnity.BuildCesiumForUnity.CompileForAndroidAndExit threw exception.

Total: 7.372500 ms (FindLiveObjects: 0.650600 ms CreateObjectMapping: 0.601500 ms MarkObjects: 6.104200 ms  DeleteObjects: 0.015000 ms)

Unhandled exception. System.Exception: An error (code 1) occurred while executing:
C:\Program Files\Unity\2021.3.26f1\Editor\Unity.exe -batchmode -nographics -projectPath C:\cesium-native\cesium-unity-samples -buildTarget Android -executeMethod CesiumForUnity.BuildCesiumForUnity.CompileForAndroidAndExit -logFile C:\Users\User\AppData\Local\Temp\tmpABF4.tmp
   at Build.Unity.Run(IEnumerable`1 args) in C:\cesium-native\cesium-unity-samples\Packages\com.cesium.unity\Build~\Unity.cs:line 81
   at Build.Package.Run() in C:\cesium-native\cesium-unity-samples\Packages\com.cesium.unity\Build~\Package.cs:line 169
   at Build.Program.Main(String[] args) in C:\cesium-native\cesium-unity-samples\Packages\com.cesium.unity\Build~\Program.cs:line 10

On our build machines, we build Windows and Android together. You’ll have you change the Package.cs file if you don’t want an Android build.

1 Like