(IN-58123) Exception when deleting image under canvas

This happens using the visionOSTemplate-0.4.3 project with 5 images directly under the “World Canvas” game object in the SampleScene.

To repro, play SampleScene in editor and then delete any of the images under the “World Canvas” game object using the Hierarchy window. These steps are done in editor, but this also happens on device with a larger project. I don’t have the exact repro steps on device, but hopefully fixing this case will also solve the issue on device.

Error:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <f646c7a159d243a7909d5204af0f0c56>:0)
Unity.PolySpatial.Internals.CanvasRendererSorter.SetCanvasSortInfo (UnityEngine.CanvasRenderer cr, Unity.PolySpatial.Internals.PolySpatialCanvasRendererTrackingData* data) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/CanvasRendererSorter.cs:192)
Unity.PolySpatial.Internals.CanvasRendererTracker.TrackNewAndModifiedObjects (UnityEngine.Object[] changedObjects) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/CanvasRendererTracker.cs:77)
Unity.PolySpatial.Internals.UnityObjectTracker`3[TObject,TEngineData,TTrackingData].FetchTypeCallback (Unity.PolySpatial.Internals.ObjectDispatcherProxy+TypeDispatchData data) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/UnityObjectTracker.cs:190)
Unity.PolySpatial.Internals.ObjectDispatcherProxy.<.ctor>b__12_0 (UnityEngine.TypeDispatchData real) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/InternalBridge/BridgeUtils.cs:118)
UnityEngine.ObjectDispatcher+<>c.<.cctor>b__54_0 (UnityEngine.Object[] changed, System.IntPtr changedID, System.IntPtr destroyedID, System.Int32 changedCount, System.Int32 destroyedCount, System.Action`1[T] callback) (at /Users/bokken/build/output/unity/unity/Runtime/Export/Misc/ObjectDispatcher.bindings.cs:162)
UnityEngine.ObjectDispatcher:DispatchTypeChangesAndClear(Type, Action`1, Boolean, Boolean)
Unity.PolySpatial.Internals.ObjectDispatcherProxy:DispatchTypeChangesAndClear(Type, Action`1) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/InternalBridge/BridgeUtils.cs:180)
Unity.PolySpatial.Internals.UnityObjectTrackerBase:FetchDirtyOneTypeIntoLists(Type) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/UnityObjectTracker.cs:27)
Unity.PolySpatial.Internals.UnityObjectTracker`3:TrackObjectChanges(LayerMask) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/UnityObjectTracker.cs:182)
Unity.PolySpatial.Internals.PolySpatialUnityTracker:TrackObjectChanges(LayerMask) (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/PolySpatialUnityTracker.cs:178)
Unity.PolySpatial.Internals.PolySpatialUnitySimulation:Update() (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/Trackers/PolySpatialUnitySimulation.cs:132)
Unity.PolySpatial.Internals.PolySpatialCore:PolySpatialAfterLateUpdate() (at /Users/bokken/build/output/unity/quantum/Packages/com.unity.polyspatial/Runtime/PolySpatialCore.cs:557)

1 Like

This would be a good one for @joejo to look into.

This is a valid bug. Please file a bug report and paste the issue id here.

Thank You.

Thanks, I filed the bug report earlier. The issue ID is IN-58123.

1 Like

Great, thank you so much.