0
Pending Review

2a10 Can't Invoke a function at editor time

TowerCrow 1 month ago updated by Lazlo Bonin (Lead Developer) 2 weeks ago 6

Function: https://imgur.com/yDsFCyV

No errors but a couple of warnings after invoking the function at editor time. The function fully works in Play mode and can also be manually invoked in play mode, the problem is with it at editor time specifically.

Inspector block accessor mismatch.
Started Inventory (BoltComponent) [Inventory (BoltClass)].trait.4adff5fa-708d-4ac5-a4ea-96dd1490f2ac, ended Inventory (BoltComponent) [Inventory (BoltClass)].trait.
UnityEngine.Debug:LogWarning(Object)
Ludiq.Inspector:EndBlock(Accessor) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:794)
Ludiq.Inspector:EndBlock() (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:779)
Ludiq.Inspector:DrawControl(Rect) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:458)
Ludiq.Inspector:DrawControl(Rect, Single&) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:543)
Ludiq.Bolt.BoltClassShellEditor:OnInnerGUI(Rect) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellEditor.cs:29)
Ludiq.Editor:OnControlGUI(Rect) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:222)
Ludiq.Inspector:DrawControl(Rect) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:456)
Ludiq.Inspector:DrawControlLayout(Single) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:858)
Ludiq.Persistent:OnGUI() (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Root/LudiqRootObjectEditor.cs:48)
Ludiq.PersistentRootEditorWrapper:OnInspectorGUI() (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/PersistentRootEditorWrapper.cs:33)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Inspector block accessor mismatch.
Started Inventory (BoltComponent) [Inventory (BoltClass)].trait, ended Inventory (BoltComponent) [Inventory (BoltClass)].
UnityEngine.Debug:LogWarning(Object)
Ludiq.Inspector:EndBlock(Accessor) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:794)
Ludiq.Inspector:EndBlock() (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:779)
Ludiq.Inspector:DrawControl(Rect) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:458)
Ludiq.Inspector:DrawControlLayout(Single) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:858)
Ludiq.Persistent:OnGUI() (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Root/LudiqRootObjectEditor.cs:48)
Ludiq.PersistentRootEditorWrapper:OnInspectorGUI() (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/PersistentRootEditorWrapper.cs:33)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Bolt Version:
2.0.0a10
Unity Version:
2019.3.0f6
Platform(s):
PC
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2

This error appears with Developer Mode enabled:

NullReferenceException: Object reference not set to an instance of an object
Ludiq.Bolt.BoltClassShellTrait.GetGraphInstance (Ludiq.Bolt.IBoltClassGraph graph) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltClassShellTrait.cs:461)
Ludiq.Bolt.BoltClassGraphUnit`1[TGraph].FetchGraphInstance (Ludiq.Bolt.Flow flow) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Architecture/BoltClassGraphUnit.cs:58)
Ludiq.Bolt.FlowFunctionUnit.Enter (Ludiq.Bolt.Flow externalFlow) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Architecture/FlowFunctionUnit.cs:95)
Ludiq.Bolt.Flow.InvokeDelegate (Ludiq.Bolt.ControlInput input) (at Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:513)
Rethrow as GraphPingException:
Ludiq.Bolt.Flow.InvokeDelegate (Ludiq.Bolt.ControlInput input) (at Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:517)
Ludiq.Bolt.Flow.Invoke (Ludiq.Bolt.ControlOutput output) (at Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:408)
Ludiq.Bolt.FlowFunction.Invoke (Ludiq.Bolt.GraphReference reference, System.Object[] args) (at Assets/Ludiq/Bolt.Flow/Runtime/Graphs/FlowFunction.cs:152)
Ludiq.Bolt.GraphInspector.OnControlGUI (UnityEngine.Rect position) (at Assets/Ludiq/Bolt.Core/Editor/Inspection/GraphInspector.cs:56)
Ludiq.Inspector.OnFieldGUI (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:245)
Ludiq.Inspector.DrawField (UnityEngine.Rect position, UnityEngine.GUIStyle labelStyle) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:536)
Ludiq.Inspector.DrawField (UnityEngine.Rect parentPosition, System.Single& y) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:548)
Ludiq.Bolt.BoltClassShellTraitEditor.OnInnerGUI (UnityEngine.Rect position) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellTraitEditor.cs:275)
Ludiq.Editor.OnControlGUI (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:222)
Ludiq.Inspector.DrawControl (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:476)
Ludiq.Inspector.DrawControl (UnityEngine.Rect parentPosition, System.Single& y) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:543)
Ludiq.Bolt.BoltClassShellEditor.OnInnerGUI (UnityEngine.Rect position) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellEditor.cs:29)
Ludiq.Editor.OnControlGUI (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:222)
Ludiq.Inspector.DrawControl (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:476)
Ludiq.Inspector.DrawControlLayout (System.Single scrollbarTrigger) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:858)
Ludiq.LudiqRootObjectEditor+Persistent.OnGUI () (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Root/LudiqRootObjectEditor.cs:48)
Ludiq.PersistentRootEditorWrapper.OnInspectorGUI () (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/PersistentRootEditorWrapper.cs:33)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.b__0 () (at <9ba1187881a84a08b5f9c4cb333d7a6a>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Need More Information

Hi TowerCrow,

Thanks for the report.

As your inventory project seems pretty involved, I think I'll have trouble reproducing this case on my end.

Is there a more isolated case in which you could provide reproduction steps to recreate the error?

My attempts to reproduce outside the inventory project have been unsuccessful. I can, however, zip up the project and send it to you if you're interested.

I can't seem to reproduce block accessor mismatch issue anymore in the Inventory project either but I still get this one: https://i.imgur.com/eYAZhq7.png

Looks like it can't call functions that are in different classes?

So here's how to reproduce the issue:

1. Create 2 classes. One that holds the editor event and another class that holds a function the editor event will call



Test Function is completely empty, Editor Event looks like this:



2. Place both classes on an object



3. Invoke Editor Event at Editor time which results in the following error: 


NullReferenceException: Object reference not set to an instance of an object
Ludiq.Bolt.BoltClassShellTrait.GetGraphInstance (Ludiq.Bolt.IBoltClassGraph graph) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/BoltClassShellTrait.cs:461)
Ludiq.Bolt.BoltClassGraphUnit`1[TGraph].FetchGraphInstance (Ludiq.Bolt.Flow flow) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Architecture/BoltClassGraphUnit.cs:58)
Ludiq.Bolt.FlowFunctionUnit.Enter (Ludiq.Bolt.Flow externalFlow) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Architecture/FlowFunctionUnit.cs:95)
Ludiq.Bolt.Flow.InvokeDelegate (Ludiq.Bolt.ControlInput input) (at Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:513)
Rethrow as GraphPingException:
Ludiq.Bolt.Flow.InvokeDelegate (Ludiq.Bolt.ControlInput input) (at Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:517)
Ludiq.Bolt.Flow.Invoke (Ludiq.Bolt.ControlOutput output) (at Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:408)
Ludiq.Bolt.FlowFunction.Invoke (Ludiq.Bolt.GraphReference reference, System.Object[] args) (at Assets/Ludiq/Bolt.Flow/Runtime/Graphs/FlowFunction.cs:152)
Ludiq.Bolt.GraphInspector.OnControlGUI (UnityEngine.Rect position) (at Assets/Ludiq/Bolt.Core/Editor/Inspection/GraphInspector.cs:56)
Ludiq.Inspector.OnFieldGUI (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:245)
Ludiq.Inspector.DrawField (UnityEngine.Rect position, UnityEngine.GUIStyle labelStyle) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:536)
Ludiq.Inspector.DrawField (UnityEngine.Rect parentPosition, System.Single& y) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:548)
Ludiq.Bolt.BoltClassShellTraitEditor.OnInnerGUI (UnityEngine.Rect position) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellTraitEditor.cs:275)
Ludiq.Editor.OnControlGUI (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:222)
Ludiq.Inspector.DrawControl (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:476)
Ludiq.Inspector.DrawControl (UnityEngine.Rect parentPosition, System.Single& y) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:543)
Ludiq.Bolt.BoltClassShellEditor.OnInnerGUI (UnityEngine.Rect position) (at Assets/Ludiq/Bolt.Core/Editor/Architecture/BoltClassShellEditor.cs:29)
Ludiq.Editor.OnControlGUI (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Editor.cs:222)
Ludiq.Inspector.DrawControl (UnityEngine.Rect position) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:476)
Ludiq.Inspector.DrawControlLayout (System.Single scrollbarTrigger) (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Inspector.cs:858)
Ludiq.LudiqRootObjectEditor+Persistent.OnGUI () (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/Root/LudiqRootObjectEditor.cs:48)
Ludiq.PersistentRootEditorWrapper.OnInspectorGUI () (at Assets/Ludiq/Ludiq.Core/Editor/Inspection/PersistentRootEditorWrapper.cs:33)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Pending Review

Thanks for the additional steps, that's starting to make sense; basically the error is when calling another function from the main editor-invoked function. I'll have a look!