public override void Instantiate(GraphReference instance) { base.Instantiate(instance); var data = instance.GetElementData <Data>(this); if (this is IGraphEventListener listener && data.isActive) { listener.StartListening(instance); }
public override EventHook GetHook(GraphReference reference) { if (!reference.hasData) { return(hookName); } var data = reference.GetElementData <Data>(this); return(new EventHook(hookName, data.target)); }
public override void Uninstantiate(GraphReference instance) { // Here, we're relying on the fact that OnDestroy calls Uninstantiate. // We need to force-dispose any remaining coroutine to avoid // memory leaks, because OnDestroy on the runner will not keep // executing MoveNext() until our soft-destroy call at the end of Flow.Coroutine // or even dispose the coroutine's enumerator (!). var data = instance.GetElementData <Data>(this); var coroutines = data.activeCoroutines.ToHashSetPooled(); #if UNITY_EDITOR new FrameDelayedCallback(() => StopAllCoroutines(coroutines), 1); #else StopAllCoroutines(coroutines); #endif base.Uninstantiate(instance); }
public override EventHook GetHook(GraphReference reference) { var refData = reference.GetElementData <Data>(this); return(ConstructHook(refData.target, _eventType)); }