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 
1 Like

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.

Hi, @kapolka , we are seeing similar issues. Do you have any update on this?

For us, it happens with bounded volume app, when exiting a game level to main scene, certain textures will not load successfully … Also, looks like sometimes first exiting to main scene may still work, but second time exiting to main scene will trigger the issue.

If not officially fixed, is there any possible workaround?


If possible, it would be great if you could create a simple project that reproduces the issue and submit it as a bug report (and let us know the incident number: IN-#####). That would go a long way towards helping us investigate.

Hi, @kapolka , thanks for the reply.

Actually we upgraded to polyspatial 1.1.6, and that issue seems no longer there! So I assume latest version should be good!

1 Like