Fail to build release package of Cesium for Unity for visionOS

Hello,
I was able to compile Cesium For Unity from source and build an AVP successfully.
But when I try to package it, it fails

Build Finished, Result: Success.
Launching external process: /Applications/Unity/Hub/Editor/2022.3.27f1/Unity.app/Contents/il2cpp/build/deploy/Analytics
##utp:{"type":"PlayerBuildInfo","version":2,"phase":"Immediate","time":1721987844293,"processId":61636,"steps":[{"description":"Preprocess Player","duration":28},{"description":"Prepare For Build","duration":0},{"description":"ProducePlayerScriptAssemblies","duration":3585},{"description":"Verify Build setup","duration":26},{"description":"Prepare assets for target platform","duration":115},{"description":"Prepare splash screen","duration":66},{"description":"Building scenes","duration":1260},{"description":"Build scripts DLLs","duration":21822},{"description":"Build GlobalGameManagers file","duration":43},{"description":"Writing asset files","duration":16322},{"description":"Building Resources/unity_builtin_extra","duration":39},{"description":"Write data build dirty tracking information","duration":59},{"description":"Postprocess built player","duration":10454}],"duration":53819}
Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
Loaded scene 'Temp/__Backupscenes/0.backup'
	Deserialize:            0.531 ms
	Integration:            4.506 ms
	Integration of assets:  0.001 ms
	Thread Wait Time:       0.009 ms
	Total Operation Time:   5.047 ms
Unloading 0 unused Assets / (0 B). Loaded Objects now: 2803.
Memory consumption went from 213.9 MB to 213.9 MB.
Total: 3.852291 ms (FindLiveObjects: 0.078417 ms CreateObjectMapping: 0.023416 ms MarkObjects: 3.744042 ms  DeleteObjects: 0.006209 ms)


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

Exception: BuildPlayer failed:
  In step Building scene Assets/Scenes/Empty.unity:
    - NotImplementedException: The native library is out of sync with the managed one.
  In step Packaging assets - resources.assets:
    - NotImplementedException: The native library is out of sync with the managed one.
  at CesiumForUnity.BuildCesiumForUnity.BuildPlayer (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String outputPath, System.Boolean deleteProject) [0x0014c] in ./Packages/com.cesium.unity/Editor/BuildCesiumForUnity.cs:191 
  at CesiumForUnity.BuildCesiumForUnity.CompileForVisionOSAndExit () [0x00027] in ./Packages/com.cesium.unity/Editor/BuildCesiumForUnity.cs:122 

(Filename: ./Packages/com.cesium.unity/Editor/BuildCesiumForUnity.cs Line: 191)

executeMethod method CesiumForUnity.BuildCesiumForUnity.CompileForVisionOSAndExit threw exception.
[Package Manager] Server::Kill -- Server was shutdown
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...


Unhandled exception. System.Exception: An error (code 1) occurred while executing:
/Applications/Unity/Hub/Editor/2022.3.27f1/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath /Users/karanmistry/Documents/CesiumForUnityBuild -buildTarget visionOS -executeMethod CesiumForUnity.BuildCesiumForUnity.CompileForVisionOSAndExit -logFile /var/folders/nz/bt4vc3715l57pg9y0rkj63sw0000gq/T/tmp1MqGQl.tmp
   at Build.Unity.Run(IEnumerable`1 args) in /Users/karanmistry/Documents/CesiumForUnityBuild/Packages/com.cesium.unity/Build~/Unity.cs:line 81
   at Build.Package.Run() in /Users/karanmistry/Documents/CesiumForUnityBuild/Packages/com.cesium.unity/Build~/Package.cs:line 244
   at Build.Program.Main(String[] args) in /Users/karanmistry/Documents/CesiumForUnityBuild/Packages/com.cesium.unity/Build~/Program.cs:line 10

Hi @Bachiieee, welcome to the community!

The problem may have occurred earlier than the start of your log. Look for a message indicating that the native code failed to compile.

2 Likes

Can’t find the error except

 In step Building scene Assets/Scenes/Empty.unity:
    - NotImplementedException: The native library is out of sync with the managed one.
  In step Packaging assets - resources.assets:
    - NotImplementedException: The native library is out of sync with the managed one.
  

Here’s the logs.

Logs.text.zip (120.6 KB)

Update: Got it compiled to a .tgz package.
But, on installing the package, we get the following errors.

Hi @Bachiieee,
I believe you can avoid those errors by packaging the .tgz on Unity 2021.3 instead of using a newer version. You can then install and use it with a newer version of Unity; it’s only during the packaging step that the newer version of Unity causes a problem.

Hi @Kevin_Ring ,
Unity 2021.3 does not have visionOS platform support.
Can I still do it and make it work for visionOS in 2022.3?

As expected :sweat_smile:

:white_check_mark: Update: I manually extracted the .tgz and repacked it with removed duplicate files. Cesium For Unity now installs fine :+1:

:warning: Issue: Before building the package, i was getting the following errors in Runtime/Resources/CesiumCreditSystem prefab.
So, I removed credit system components just to build the package successfully.
Turns out, after installing Cesium For Unity, that component was critical and I need to add it back and then rebuild the package.

Can you please advise me on how to fix these errors of : The native library is out of sync with the managed one ?

1 Like