InvalidOperationException: Trying to access unloaded resource!

We have been getting this exception several times when making changes to the flow of our game - which suggests that it might be timing dependent. We have never found a way around it. Is there something we need to look out for? I don’t think we are able to create a repro project for the issue, so creating a bug report will be difficult.

In the current case it seems that a mesh (Pyramid) in scene A is being accessed after loading scene B where the mesh is not present.

This is the full stack trace for context:

InvalidOperationException: Trying to access unloaded resource! [0d6da57b-bf73-4b6f-b64b-c27c8eca84c2 (has 42 polyspatial refs, is unity referenced): resource alive: False iid=14554 name=Pyramid type=Mesh
  at Unity.PolySpatial.Internals.AssetRepresentation.get_Resource () [0x00000] in <00000000000000000000000000000000>:0 
  at Unity.PolySpatial.Internals.LocalAssetManager.ProcessChangedAsset (Unity.PolySpatial.Internals.AssetRepresentation representation) [0x00000] in <00000000000000000000000000000000>:0 
  at Unity.PolySpatial.Internals.LocalAssetManager.FetchAssetChangesCallback (Unity.PolySpatial.Internals.ObjectDispatcherProxy+TypeDispatchData data) [0x00000] in <00000000000000000000000000000000>:0 
  at Unity.PolySpatial.Internals.ObjectDispatcherProxy+<>c__DisplayClass13_0.<.ctor>b__0 (UnityEngine.TypeDispatchData real) [0x00000] in <00000000000000000000000000000000>:0 
  at 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) [0x00000] in <00000000000000000000000000000000>:0 
  at Unity.PolySpatial.Internals.LocalAssetManager.ProcessChanges () [0x00000] in <00000000000000000000000000000000>:0 
  at Unity.PolySpatial.Internals.PolySpatialUnitySimulation.UpdateInternal () [0x00000] in <00000000000000000000000000000000>:0 
  at Unity.PolySpatial.Internals.PolySpatialCore.PolySpatialAfterLateUpdate () [0x00000] in <00000000000000000000000000000000>:0 
Unity.PolySpatial.Internals.LocalAssetManager:ProcessChanges()
Unity.PolySpatial.Internals.PolySpatialUnitySimulation:UpdateInternal()
Unity.PolySpatial.Internals.PolySpatialCore:PolySpatialAfterLateUpdate()

Yeah, this seems like it’s likely to be an order of operations issue on our end; basically, we’re trying to process an asset change after we’ve already marked the asset as unloaded. I wonder if it’s specific to assets that are changed and unloaded on the same frame. I’ll try to replicate that, but on the off chance that you do find a repro-able case, please let us know.