Crash on Device 'PolySpatialRealityKit/PolySpatialImplUtils.swift:52: Fatal error: Entity 13350:0 not found'

Hi there,

I’m porting my game to visionOS platform. I did most of changes to make it to be compatible with visionOS system.

I use bounded volume for main menu, and unbounded volume for the playable level scenes.
Main menu starts as expected, but whenever I load a level scene a crash occurs as follows:

on Device:

RequestDestroyTexture
RequestCreateTexture
SetupRenderTextureFromXRRequest (id: 2 col: 0x0 d: 0x0 sr: 0x0)
RenderTexture::Create (id: 2)
[Platform] Entity 13350:0 not found
PolySpatialRealityKit/PolySpatialImplUtils.swift:52: Fatal error: Entity 13350:0 not found

in Simulator:

[Diagnostics] Exception in multicast command handler PolySpatialUnityBackend, removing: System.Collections.Generic.KeyNotFoundException: The given key ‘290620:0’ was not present in the dictionary.
at System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) [0x0001e] in <dcf6bec1c5764d29a37432d4b047f650>:0 at Unity.PolySpatial.Internals.UnitySceneGraph.FindBackingGameObjectForId (Unity.PolySpatial.Internals.PolySpatialInstanceID simIid) [0x00000] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/UnitySceneGraph.cs:237 at Unity.PolySpatial.Internals.UnitySceneGraph.AddEntitiesWithTransforms (System.Span1[T] ids, System.Span1[T] parents, System.Span1[T] localPositions, System.Span1[T] localRotations, System.Span1[T] localScales, System.Span1[T] states) [0x00084] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/UnitySceneGraph.cs:402 at Unity.PolySpatial.Internals.PolySpatialUnityBackend.OnSendClientCommand (Unity.PolySpatial.Internals.PolySpatialCommand command, System.Int32 argCount, System.Void** args, System.Int32* argSizes) [0x002cb] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/PolySpatialUnityBackend.cs:242 at Unity.PolySpatial.Internals.PolySpatialUnityBackend.HandleCommand (Unity.PolySpatial.Internals.PolySpatialCommand cmd, System.Int32 argCount, System.Void** argValues, System.Int32* argSizes) [0x00011] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/PolySpatialUnityBackend.cs:157 at Unity.PolySpatial.Internals.MulticastHandler+Safe.HandleCommand (Unity.PolySpatial.Internals.PolySpatialCommand cmd, System.Int32 argCount, System.Void** argValues, System.Int32* argSizes) [0x00015] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Handlers/MulticastHandler.cs:85 at System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) [0x0001e] in :0
at Unity.PolySpatial.Internals.UnitySceneGraph.FindBackingGameObjectForId (Unity.PolySpatial.Internals.PolySpatialInstanceID simIid) [0x00000] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/UnitySceneGraph.cs:237
at Unity.PolySpatial.Internals.UnitySceneGraph.AddEntitiesWithTransforms (System.Span1[T] ids, System.Span1[T] parents, System.Span1[T] localPositions, System.Span1[T] localRotations, System.Span1[T] localScales, System.Span1[T] states) [0x00084] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/UnitySceneGraph.cs:402
at Unity.PolySpatial.Internals.PolySpatialUnityBackend.OnSendClientCommand (Unity.PolySpatial.Internals.PolySpatialCommand command, System.Int32 argCount, System.Void** args, System.Int32* argSizes) [0x002cb] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/PolySpatialUnityBackend.cs:242
at Unity.PolySpatial.Internals.PolySpatialUnityBackend.HandleCommand (Unity.PolySpatial.Internals.PolySpatialCommand cmd, System.Int32 argCount, System.Void** argValues, System.Int32* argSizes) [0x00011] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Platforms/Unity/PolySpatialUnityBackend.cs:157
at Unity.PolySpatial.Internals.MulticastHandler+Safe.HandleCommand (Unity.PolySpatial.Internals.PolySpatialCommand cmd, System.Int32 argCount, System.Void** argValues, System.Int32* argSizes) [0x00015] in /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Handlers/MulticastHandler.cs:85

Loading a levels involves these steps:
Main menu scene → Singleplayer scene → Level_01 scene (Additive)

Singleplayer scene contains common game objects for all levels (AR Session, XR Origin etc). I checked all scenes with project validator and there is no error/warning.

  • I use “Bake to Mesh” for particle system mode.
  • PolySpatial v 1.0.3
  • Unity 2022.3.19f1
  • AR Foundation 5.1.2
  • Universal Render Pipeline 14.0.10

Thanks

Solved the issue;

I copied XR rig setup from Unity’s example project before. I recreated the same structure and it works now.