Bug: Get MissingReferenceException if object with RichAI and CharacterController has its properties open in a floating window

  • A* version: 5.3.2
  • Unity version: 2022.3.55

If I have an empty object with RichAI and a Character Controller, and open its properties into a floating window (as in, RMB in the Hierarchy, click ‘Properties…’), I get this:

Message 1:
Undo objects may not be null.

Message 2:
MissingReferenceException: The object of type ‘RichAI’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.TryGetComponent[T] (T& component) (at :0)
Pathfinding.BaseAIEditor.Inspector () (at ./Packages/com.arongranberg.astar/Editor/AIBaseEditor.cs:120)
Pathfinding.EditorBase.OnInspectorGUI () (at ./Packages/com.arongranberg.astar/PackageTools/Editor/EditorBase.cs:102)
UnityEngine.Debug:LogException(Exception, Object)
Pathfinding.EditorBase:OnInspectorGUI() (at ./Packages/com.arongranberg.astar/PackageTools/Editor/EditorBase.cs:107)
UnityEditor.InspectorWindow:RedrawFromNative()

Message 3:
MissingReferenceException: The object of type ‘RichAI’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.TryGetComponent[T] (T& component) (at :0)
Pathfinding.BaseAIEditor.Inspector () (at ./Packages/com.arongranberg.astar/Editor/AIBaseEditor.cs:120)
Pathfinding.EditorBase.OnInspectorGUI () (at ./Packages/com.arongranberg.astar/PackageTools/Editor/EditorBase.cs:102)
UnityEngine.Debug:LogException(Exception, Object)
Pathfinding.EditorBase:OnInspectorGUI() (at ./Packages/com.arongranberg.astar/PackageTools/Editor/EditorBase.cs:107)
UnityEditor.InspectorWindow:RedrawFromNative()

Message 4:
MissingReferenceException: The object of type ‘RichAI’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
Pathfinding.EditorBase.OnInspectorGUI () (at ./Packages/com.arongranberg.astar/PackageTools/Editor/EditorBase.cs:110)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass77_0.b__0 () (at :0)
UnityEditor.InspectorWindow:RedrawFromNative()

The error messages don’t appear if I remove the Character Controller from the object while the floating window is up, and of course the error messages don’t appear if I just close the floating window, without removing any of the components.

Edit: Just noticed that the errors also only occur if both RichAI and Character Controller components are expanded (so that all of their fields are visible), and it doesn’t seem to matter if they’re enabled or not as far as I can tell. Also can’t get the “Undo objects may not be null.” message anymore, don’t know why.

Hi

That’s very strange. It seems some fundamental invariants of the editor have been broken.
I would guess that this is a Unity bug. Can you replicate this in any newer version of Unity?

Hello

I also get it in 6000.0.36, with A* ver 5.3.2. I’m getting the ‘Undo objects may not be null’ error here again, as well as ‘MissingReferenceException: The object of type ‘Pathfinding.Seeker’ has been destroyed but you are still trying to access it.’ Same exact trigger conditions as with 2022.3.55.

Also realized I didn’t fully copy-paste the first error message, it said:
Undo objects may not be null.
UnityEditor.Undo:RecordObjects (UnityEngine.Object,string)
Pathfinding.SeekerEditor:Inspector () (at ./Packages/com.arongranberg.astar/Editor/SeekerEditor.cs:21)
Pathfinding.EditorBase:OnInspectorGUI () (at ./Packages/com.arongranberg.astar/PackageTools/Editor/EditorBase.cs:102)
UnityEditor.InspectorWindow:RedrawFromNative ()

Edit:
Same thing in another project, 2022.3.53, with A* ver 5.2.5
But not in a 2021.3.42 project, with A* ver 5.3.2

Edit 2:
Another little detail, the errors only show if Character Controller is below Rich AI in the Inspector.