Not a Bug

2.0.0a7 Flow Function Graphs can only be used in other classes if the Function's class of origin is also on the object

Ex-Crow 1 year ago updated by Lazlo Bonin (Lead Developer) 1 year ago 1

Not sure if a bug or this is by design but Flow Functions can only be used in other classes if the class containing the function is also on the object. Or if the function is in Scene or Singleton class scopes, which the object also "sees". 

DoSomething Graph: https://imgur.com/HJxOeNb

UtilityFunction Graph: https://imgur.com/f0z3CJH

Does not work with UtilityFunction in DoSomething behaviour:

NullReferenceException: Missing target.
Ludiq.Bolt.ClassGraphUnit`1[TGraph].FetchGraphInstance (Ludiq.Bolt.Flow flow) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Architecture/ClassGraphUnit.cs:54)
Ludiq.Bolt.FlowFunctionUnit.Enter (Ludiq.Bolt.Flow externalFlow) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Architecture/FlowFunctionUnit.cs:89)
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.EventHandlerUnit`1[TArgs].Invoke (Ludiq.Bolt.GraphReference reference, TArgs args) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Events/EventHandlerUnit.cs:114)
Ludiq.Bolt.EventHandlerUnit`1+<>c__DisplayClass17_0[TArgs].b__0 (TArgs args) (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Events/EventHandlerUnit.cs:73)
Ludiq.Bolt.EventBus.Invoke[TArgs] (Ludiq.Bolt.EventHook hook, TArgs args) (at Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:153)
UnityEngine.Debug:LogException(Exception, Object)
Ludiq.Bolt.EventBus:Invoke(EventHook, EmptyEventArgs) (at Assets/Ludiq/Bolt.Core/Runtime/Events/EventBus.cs:157)
Ludiq.Bolt.ClassHost:InvokeEvent(EventHookID) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:813)
Ludiq.Bolt.UnityClassHost:Start() (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/UnityClassHost.cs:29)
Ludiq.Bolt.ClassComponent:Start() (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassComponent.cs:85)

Works if ClassWithFlowFunction is also on the TestObject:

Works if ClassWithFlowFunction is Scene/Singleton scope:

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Satisfaction mark by Ex-Crow 1 year ago
Not a Bug

Hi TowerCrow,

That is by design, it's the exact same case as your other report on component events on multiple game objects.

Each class instance has its own function. If you want to call that function on another game object, you have to tell Bolt on which game object to look. Otherwise it simply won't know which!