Build a Working Result
Build Your First Flow
Make a Cube grow when Play Mode starts by combining a graph, process, Blackboard, Trigger, and Action.
- Audience
- New to Flow Core
- Time
- 10–15 minutes
- Requires
- A writable Unity scene
- Modules
- Flow Core
On this page
Create a Cube that changes from scale (1, 1, 1) to (2, 2, 2) when Play Mode starts. This result exercises the complete Flow Core loop without requiring C#.
What you will build
此处插图应该是教程最终结果的 Unity Game 或 Scene 视图对比截图;左侧显示 scale 为 1 的 Cube,右侧显示 Play Mode 中 scale 为 2 的 Cube,并标注 Before 与 After。
Watch the complete first-graph authoring loop, then use the written steps below as the exact configuration for this tutorial.
Create the scene owner
- Create a Cube and name it
Growing Cube. - Keep its Transform scale at
(1, 1, 1). - Add a
FlowCoreProcesscomponent. - Add a
Blackboardcomponent to the same GameObject.
Keeping the process, Blackboard, and visible object together makes the first runtime ownership path easy to inspect.
此处插图应该是 Growing Cube 的 Unity Inspector 截图;保留 Transform、FlowCoreProcess 和 Blackboard 三个组件标题,并框选两个 Flow Core 组件。
Create and assign the graph
- In the Project window, use
Create > Flow Core > Flow Graph. - Name the asset
GrowCubeFlow. - Return to
Growing Cubeand assignGrowCubeFlowto itsFlowCoreProcess.
The graph stores authored nodes and connections. Assigning it to the process creates the scene relationship that will build a runtime instance.
Add the typed value
- Open the
Blackboardcomponent’s Edit view. - Add a
Vector3key namedTargetScale. - Set its value to
(2, 2, 2). - In
FlowCoreProcess, add this Blackboard toLocal Blackboardsat index0.
此处插图应该是 Blackboard Edit 视图与 FlowCoreProcess Local Blackboards 列表的组合截图;显示 Vector3 TargetScale 为 2,2,2,并框选 Local 索引 0 的绑定。
Add the Start Trigger
- Open
GrowCubeFlowin the Flow Graph Editor. - Set Debug Context to
Growing Cube. - Right-click the canvas and add a
Triggernode. - Set
BustoUnity. - Set
Unity EventtoStart.
Unity will publish this lifecycle event after the process builds its runtime in Play Mode.
Add the scaling Action
- Add an
Actionnode. - Connect
Trigger.OuttoAction.In. - Select the Action and add
Set LocalScalefromTransform/GameObject. - Keep
Instanceresolved fromSelfandScopeset toSelf. - Configure
Valueto read fromBlackboard. - Select
Local, index0, keyTargetScale.
此处插图应该是 Flow Graph Editor 中 Start Trigger 已连接到 Action 的截图;保留两个节点、连接线与 Action 指令列表,并框选 Set LocalScale。
此处插图应该是 Set LocalScale 指令展开后的编辑截图;显示 Instance 为 Self、Scope 为 Self、Value 来源为 Local Blackboard[0] 的 TargetScale,并框选这些关键字段。
Verify the result
- Save the scene and graph.
- Select
Growing Cubeand confirm its scale is(1, 1, 1)before Play Mode. - Enter Play Mode.
- Confirm its Transform scale becomes
(2, 2, 2). - Exit Play Mode and confirm the authored Transform returns to
(1, 1, 1).
Common Mistakes
| Symptom | Check |
|---|---|
| The Cube does not change | Confirm GrowCubeFlow is assigned to FlowCoreProcess and the component is enabled. |
| The Trigger does not run | Confirm the bus is Unity and the selected event is Start. |
| The Action does not run | Confirm Trigger.Out is connected to Action.In. |
| Scale becomes the wrong value | Confirm TargetScale is a Vector3 at Local index 0. |
| The target cannot resolve | Keep Instance and component Scope on Self for this tutorial. |
| Editor summaries are unresolved | Set Debug Context to Growing Cube. |
What You Built
You authored behavior in a Flow Graph, gave that graph a scene runtime through FlowCoreProcess, stored configuration in a typed Blackboard, started a chain from a Unity Trigger, and used an Action to change a Unity component.
Change TargetScale to (1, 3, 1) and run the scene again. The visible result should change without editing graph topology.