Crash: FetchTransformLocalTRSCallback

We’re having trouble tracking down a crash when loading one of our scenes. We’re not seeing it in editor - only on device/simulation. I’ve checked our hierarchy so that PolySpatial-replicated objects have also-replicated parents (object layers are all correct). Is there any other reason we might be seeing this? Anything I should check?

NullReferenceException: Object reference not set to an instance of an object.
Unity.PolySpatial.Internals.TransformTracker.FetchTransformLocalTRSCallback (Unity.PolySpatial.Internals.ObjectDispatcherProxy+TransformDispatchData changes) ()
Unity.PolySpatial.Internals.ObjectDispatcherProxy+<>c__DisplayClass14_0.<.ctor>b__1 (UnityEngine.TransformDispatchData real) ()
UnityEngine.ObjectDispatcher+<>c.<.cctor>b__54_1 (System.IntPtr transformed, System.IntPtr parents, System.IntPtr localToWorldMatrices, System.IntPtr positions, System.IntPtr rotations, System.IntPtr scales, System.Int32 count, System.Action`1[T] callback) ()
Unity.PolySpatial.Internals.TransformTracker.ProcessNewAndModifiedObjects () ()
Unity.PolySpatial.Internals.PolySpatialUnityTracker.ProcessNewAndModifiedObjects () ()
Unity.PolySpatial.Internals.PolySpatialUnityTracker.Process () ()
Unity.PolySpatial.Internals.PolySpatialUnitySimulation.Update () ()
Unity.PolySpatial.Internals.PolySpatialCore.PolySpatialAfterLateUpdate () ()
Unity.PolySpatial.Internals.TransformTracker:ProcessNewAndModifiedObjects()
Unity.PolySpatial.Internals.PolySpatialUnityTracker:ProcessNewAndModifiedObjects()
Unity.PolySpatial.Internals.PolySpatialUnityTracker:Process()
Unity.PolySpatial.Internals.PolySpatialUnitySimulation:Update()
Unity.PolySpatial.Internals.PolySpatialCore:PolySpatialAfterLateUpdate()

It looks like this is caused by (for some reason) an instance ID that no longer corresponds to a valid Transform, or a Transform that (somehow) no longer has a valid GameObject. The only thing that comes to mind offhand is that perhaps you’re using DestroyImmediate rather than Destroy, and that that’s causing issues with the transform tracking.

Regardless, if it’s possible to create a repro case in a bug report and let us know the incident number (IN-#####), that would help us debug.

We get this crash when some of our UI Canvas elements are active. Maybe you can trace it back to them as well.

Thanks for the tips! It was indeed a rogue DestroyImmediate - crash is fixed now :slight_smile:

1 Like

We’re still seeing this crash at seemingly random times. I’ve scoured and purged our codebase for DestroyImmediates, so unless there is some package/library somewhere calling this (I notice TMPro has a lot), is there anything else that would cause this?

Stacktrace and screenshot:

NullReferenceException: Object reference not set to an instance of an object.
Unity.PolySpatial.Internals.TransformTracker.FetchTransformLocalTRSCallback (Unity.PolySpatial.Internals.ObjectDispatcherProxy+TransformDispatchData changes) ()
Unity.PolySpatial.Internals.ObjectDispatcherProxy+<>c__DisplayClass14_0.<.ctor>b__1 (UnityEngine.TransformDispatchData real) ()
UnityEngine.ObjectDispatcher+<>c.<.cctor>b__54_1 (System.IntPtr transformed, System.IntPtr parents, System.IntPtr localToWorldMatrices, System.IntPtr positions, System.IntPtr rotations, System.IntPtr scales, System.Int32 count, System.Action`1[T] callback) ()
Unity.PolySpatial.Internals.TransformTracker.ProcessNewAndModifiedObjects () ()
Unity.PolySpatial.Internals.PolySpatialUnityTracker.ProcessNewAndModifiedObjects () ()
Unity.PolySpatial.Internals.PolySpatialUnityTracker.Process () ()
Unity.PolySpatial.Internals.PolySpatialUnitySimulation.UpdateInternal () ()
Unity.PolySpatial.Internals.PolySpatialCore.PolySpatialAfterLateUpdate () ()
Unity.PolySpatial.Internals.TransformTracker:ProcessNewAndModifiedObjects()
Unity.PolySpatial.Internals.PolySpatialUnityTracker:ProcessNewAndModifiedObjects()
Unity.PolySpatial.Internals.PolySpatialUnityTracker:Process()
Unity.PolySpatial.Internals.PolySpatialUnitySimulation:UpdateInternal()
Unity.PolySpatial.Internals.PolySpatialCore:PolySpatialAfterLateUpdate()