# 6. Behavior Pitfalls Part of [[Unity Behavior]]. Prev: [[5. Worked Example Guard Graph]]. ## Two movers on one NavMeshAgent A leftover FSM and a graph both calling `SetDestination`. One authority for locomotion. ## `SetVariableValue` before vs after `Init` Official: before `Init` is an **agent override**; after is the **instance** blackboard. A Target set too early can look like "every clone chases the same object." ## Setting `Graph` and immediately reading instance variables in the same line Official: assigning `Graph` at runtime initializes on the **next Update** unless you call `Init()` yourself. If you need values this frame, call `Init()` (and remember official `Init` on an already-initialized agent reclones and restarts). ## Invented library node names or a hand-rolled `[NodeDescription]` Use the 1.0.17 Add menu and the **Create new** wizard. Leave generated identity attributes alone. ## Agent-bound event vs asset event channel Official: `SendEventMessage` on an agent's channel variable targets that instance (unless Shared). The **asset** channel broadcasts to everyone assigned that instance. Mixing them is how "only this guard" alerts the whole floor — or the reverse. ## Starting the agent enabled when you wanted a disabled start Official: disable `BehaviorGraphAgent` at creation if it must not tick yet. ## Porting a boss phase table into a graph "because we have the package" Keep [[Boss Battles with Phases]] as the phase FSM. A graph can run *inside* a phase. ## 1.0.16 vs 1.0.17 This series was checked against **1.0.17** (released for 6000.5). If Package Manager resolves **1.0.16**, read that changelog before you assume a 1.0.17 wizard detail applies. ## "It worked in the graph debugger once" The assignment includes two instances with different blackboard overrides, and a proof that the old FSM is not also running. ## Sources - https://docs.unity3d.com/Packages/[email protected]/api/Unity.Behavior.BehaviorGraphAgent.html - https://docs.unity3d.com/Packages/[email protected]/manual/create-custom-node.html