0
Answered

Simple 2 state diagram

ibolcina 2 years ago updated by Reality.Stop() 2 years ago 3

I have two states and one transition

on the end of first state, i call "trigger transition" and then i get that exception.

Transition flow contains only "trigger transition" node.


Please help


GraphPointerException: Graph pointer must be within a Bolt.INesterStateTransition for this operation.

[ HangarDoor > FlowState#0d96b... ]
Ludiq.GraphPointer.EnsureWithin[T] () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Graphs/Runtime/GraphPointer.cs:268)
Ludiq.GraphPointer.GetParent[T] () (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Graphs/Runtime/GraphPointer.cs:276)
Bolt.TriggerStateTransition.Trigger (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Ludiq/Bolt.State/Runtime/TriggerStateTransition.cs:28)
Bolt.Flow.InvokeDelegate (Bolt.ControlInput input) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow.cs:373)
Bolt.Flow.Invoke (Bolt.ControlOutput output) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow.cs:267)
Bolt.Flow.Invoke (Bolt.ControlOutput output) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow.cs:271)
Bolt.Flow.Invoke (Bolt.ControlOutput output) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow.cs:271)
Bolt.Flow.Invoke (Bolt.ControlOutput output) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow.cs:271)
Bolt.Flow.Run (Bolt.ControlOutput port, System.Boolean coroutine) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow.cs:234)
Bolt.EventUnit`1[TArgs].Run (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:133)
Bolt.EventUnit`1[TArgs].Trigger (Ludiq.GraphReference reference, TArgs args) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:110)
Bolt.EventUnit`1+<>c__DisplayClass14_0[TArgs].<StartListening>b__0 (TArgs args) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:65)
Bolt.EventBus.Trigger[TArgs] (Bolt.EventHook hook, TArgs args) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:65)
Bolt.EventBus.Trigger[TArgs] (System.String name, UnityEngine.GameObject target, TArgs args) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:74)
Bolt.UnityMessageListener.OnTriggerEnter (UnityEngine.Collider other) (at C:/Users/lazlo/Projects/Ludiq/Bolt.Core/Runtime/Events/UnityMessageListener.cs:23

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Answered

Hi there! You shouldn't call Trigger Transition from the state, you should only call it from the transition itself.

Thanks. How do I exit state then?

+1

Put your condition to exit the state in the transition.  Bolt will automatically handle any transition that indicates that it should transition.


If you just want to transition once your logic is done, you could trigger a custom event in the state and catch the event in the transition, or you could use a Late Update or something that will happen after your logic is done processing.