There seems to be a compatibility issue with the Behavior Graph UI in the Editor and PolySpatial. Both of these features are obviously very new (especially Behavior Graph), and their combination might not yet be very well tested.
When I’m testing my PolySpatial app in the Editor, things can break if I decide to open the Behavior Graph tab to spy on my NPC’s graph flow. It doesn’t happen every time, but about 50 percent of the time, opening that window and/or selecting the NPC gameobject from the hierarchy can trigger the following errors:
[Diagnostics] EXCEPTION InvalidOperationException in PolySpatialCore:
at Unity.PolySpatial.Internals.AssetRepresentation.get_Resource () [0x0002d] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/AssetRepresentation.cs:39
at Unity.PolySpatial.Internals.LocalAssetManager.ProcessChangedAsset (Unity.PolySpatial.Internals.AssetRepresentation representation) [0x00050] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/LocalAssetManager.cs:1198
at Unity.PolySpatial.Internals.LocalAssetManager.FetchAssetChangesCallback (Unity.PolySpatial.Internals.ObjectDispatcherProxy+TypeDispatchData data) [0x00076] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/LocalAssetManager.cs:1144
at Unity.PolySpatial.Internals.LocalAssetManager.ProcessChanges () [0x00055] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/LocalAssetManager.cs:821
at Unity.PolySpatial.Internals.PolySpatialUnitySimulation.UpdateInternal () [0x000f8] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/Trackers/PolySpatialUnitySimulation.cs:271
at Unity.PolySpatial.Internals.PolySpatialUnitySimulation.Update () [0x00015] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/Trackers/PolySpatialUnitySimulation.cs:209
at Unity.PolySpatial.Internals.PolySpatialCore.PolySpatialAfterLateUpdate () [0x000e8] in /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/PolySpatialCore.cs:709
InvalidOperationException: Trying to access unloaded resource! [55478d86-2984-7254-7ac2-a4f6f048f0a8:2100000 (has 1 polyspatial refs, is unity referenced): resource alive: False iid=63626 name=SimEnvironment_Carpet type=Material
Unity.PolySpatial.Internals.AssetRepresentation.get_Resource () (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/AssetRepresentation.cs:39)
Unity.PolySpatial.Internals.LocalAssetManager.ProcessChangedAsset (Unity.PolySpatial.Internals.AssetRepresentation representation) (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/LocalAssetManager.cs:1198)
Unity.PolySpatial.Internals.LocalAssetManager.FetchAssetChangesCallback (Unity.PolySpatial.Internals.ObjectDispatcherProxy+TypeDispatchData data) (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/LocalAssetManager.cs:1144)
Unity.PolySpatial.Internals.LocalAssetManager.ProcessChanges () (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/AssetManagement/LocalAssetManager.cs:821)
Unity.PolySpatial.Internals.PolySpatialUnitySimulation.UpdateInternal () (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/Trackers/PolySpatialUnitySimulation.cs:271)
Unity.PolySpatial.Internals.PolySpatialUnitySimulation.Update () (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/Trackers/PolySpatialUnitySimulation.cs:209)
Unity.PolySpatial.Internals.PolySpatialCore.PolySpatialAfterLateUpdate () (at /Users/bokken/build/output/unity/polyspatial/Packages/com.unity.polyspatial/Runtime/PolySpatialCore.cs:722)
The renderer completely gives out, rendering my XR simulated environment with a weird “depth only” presentation, and none of the XR simulated interactions with the mouse will work. The remedy is to stop playback restart, and thankfully this only seems to be affecting Editor playback.
These errors have appeared before in PolySpatial, but were previously “fixed”. I actually replied to this forum post recently, mistakenly thinking I had fixed my issue (my confusion lied with the fact it doesn’t happen 100% of the time).
My current workaround is to just kind of not touch the Behavior Graph window during Editor playback until I really need it, at which case I’m knowingly preparing for the bug to happen.
Edit:
Unity 6000.0.31f1
Polyspatial: 2.1.2
Behavior Graph: 1.0.6