Skip to main content
Flow Core Documentation
Menu

Integration

Integrating Third-Party Systems

Bridge external data and events through stable Flow Core boundaries.

Audience
Integration developers
Time
20 minutes
Requires
C# and ownership of the external integration layer
Modules
Flow Core, C#
On this page

Connect another package through typed data, events, or an explicit graph-selection boundary. The bridge translates ownership; it should not depend on generated internals or mutate graph topology at runtime.

Choose a bridge type

External system ownsFlow Core receivesUse
Current stateTyped Blackboard valuesData bridge
A callback or requestTrigger signal or named EntryEvent bridge
Which graph variant appliesA supported graph asset wrapperGraph-selection bridge

Data bridge

Mirror a value only when the external system remains its source of truth:

using UnityEngine;
using TwoCatsCode.FlowCore;

public sealed class HealthFlowBridge : MonoBehaviour
{
    private static readonly BlackboardKey HealthKey = new("Health");

    [SerializeField] private Blackboard blackboard;

    public void PublishHealth(float currentHealth)
    {
        if (blackboard != null)
        {
            blackboard.Set(HealthKey, currentHealth);
        }
    }
}

Create the matching typed key and bind the Blackboard to any process that reads it. Avoid two-way synchronization unless one side has a documented conflict rule.

Event bridge

Translate a main-thread callback into a Flow event:

using UnityEngine;
using TwoCatsCode.FlowCore;

public sealed class QuestFlowBridge : MonoBehaviour
{
    private static readonly FlowEventKey QuestStarted = new("Quest.Started");

    public void OnQuestStarted(int questId)
    {
        FlowEventBus.Global.Publish(
            QuestStarted,
            new FlowTriggerPayload(questId),
            FlowSignalContext.None);
    }
}

Add a graph Trigger for the same event key and match the expected payload type. Unbind external callbacks when the bridge is disabled or disposed.

Image 05_04_01Screenshot production note

此处插图应该是外部 Quest 系统、QuestFlowBridge、Flow Event Trigger 与下游 Action 的架构截图;显示 Quest.Started 键和 Int payload 从代码进入 Graph 的路径。

Integration rules

  • Keep one source of truth for each value.
  • Initialize required data before the first relevant Trigger or Entry.
  • Publish events and mutate runtime state on Unity’s main thread.
  • Cache keys and references instead of parsing strings every frame.
  • Avoid writing unchanged data in high-frequency bridges.
  • Prevent feedback loops between external events and graph responses.
  • Defer destructive cleanup when a callback would remove listeners or objects during the same dispatch.

Verify the bridge

Common Mistakes

SymptomCheck
Graph reads an old valueConfirm bridge initialization and update order.
An event arrives twiceCheck duplicate callback subscriptions and feedback loops.
Payload cannot resolveMatch the Trigger payload type and published value.
Behavior fails off the main threadMarshal the external callback to Unity before calling Flow Core.
A shared graph leaks stateKeep mutable state in each process, Blackboard, or external owner.

What You Built

You established a narrow translation layer in which the external package keeps ownership of its data or callback while Flow Core receives one typed value or event through a supported boundary.