0
Fixed (Unreleased)

2.0.0a6 ObjectDisposed exception when using OnKeyboardInput or OnMouseInput

t1ny_bear 1 month ago updated by Lazlo Bonin (Lead Developer) 1 month ago 2

I created ClassDefinition with one Flow Behaviour graph:

I placed into it OnKeyboardInput event:

Ran my project, added ClassComponent to the GameObject and droped this ClassDefinition file. After disable/enable the component I take exception:

[Exception] ObjectDisposedException: Cannot access a disposed object.
Object name: 'Ludiq.Bolt.Flow'.
Flow.Dispose() Assets/Ludiq/Bolt.Flow/Runtime/Flow.cs:125
123: if (disposed)
124: {
-->125: throw new ObjectDisposedException(ToString());
126: }

Ludiq.Bolt.EventHandlerUnit`1[TArgs].Invoke() Assets/Ludiq/Bolt.Flow/Runtime/Units/Events/EventHandlerUnit.cs:107
106: Run(flow);
-->107: }
108: }

Ludiq.Bolt.EventHandlerUnit`1+<>c__DisplayClass17_0[TArgs].b__0() Assets/Ludiq/Bolt.Flow/Runtime/Units/Events/EventHandlerUnit.cs:73
71: {
72: var data = instance.GetElementData(this);
-->73: Action handler = args => Invoke(instance, args);
74: EventBus.Add(data.hook, handler);
75: data.handler = handler;

EventBus.Invoke[TArgs]() Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:153
151: try
152: {
-->153: handler.Invoke(args);
154: }
155: catch (Exception ex)

Debug.LogException()

EventBus.Invoke() Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:157
155: catch (Exception ex)
156: {
-->157: Debug.LogException(ex, hook.target as UnityObject);
158: }
159: }

ClassHost.InvokeEvent() Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:813
811: protected void InvokeEvent(EventHookID id)
812: {
-->813: EventBus.Invoke(CreateEventHook(id), new EmptyEventArgs());
814: }

UnityClassHost.Update() Assets/Ludiq/Bolt.Core/Runtime/Architecture/UnityClassHost.cs:33
31: public void Update()
32: {
-->33: InvokeEvent(UnityEvents.Update);
34: }

ClassComponent.Update() Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassComponent.cs:92
90: private void Update()
91: {
-->92: host.Update();
93: }

P.S: I don't know if this normal behaviour or not, but I figured out that my my definition file starts in ClassComponent when I toggling the component. I couldn't found any other way how to make definition start.

I'll be appreciate if someone open my eyes up about that.

Bolt Version:
2.0.0.6a
Unity Version:
2019.2.1f1
Platform(s):
Windows
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Working on Fix

Hi Tiny Bear, 

Thanks for the report, this is definitely a bug, looking into it.

Fixed (Unreleased)

Will be fixed in next version, thanks!