Override System¶
The override system lets you tune action, goal, belief, and transition parameters on a per-agent basis without creating a new Brain asset. This is how you create agent variations from a shared brain template.
Why Overrides?¶
A single Brain asset can be shared by many agents. But you might want:
- A veteran guard with higher detection range
- A cowardly enemy with a lower attack priority
- A specific agent that ignores certain transitions
Overrides change parameters without changing the brain's structure. The planner topology (actions, goals, beliefs, transitions) stays the same — only the numbers change.
Four Override Types¶
| Override Type | What You Can Change | What Stays the Same |
|---|---|---|
| Action | Strategy, settings, cost, post-processes | Preconditions, effects, planner topology |
| Goal | Priority, validity conditions | Desired state, transitions |
| Belief | Settings (range, threshold, etc.) | Same bit in TagMask128, same Evaluate() logic |
| Transition | Enabled/disabled, condition | Source/target state |
Action Overrides¶
Swap the strategy, change settings, or adjust cost for a specific agent:
var context = agent.GetContext<GoapAgentContext>();
// Override an action's cost
context.SetActionOverride(actionInstance, new GoapActionOverrideEntry
{
Strategy = customStrategy,
Settings = customSettings,
Cost = 5f
});
// Remove the override (revert to brain defaults)
context.RemoveActionOverride(actionInstance);
Use case: A wounded agent uses a slower, more cautious movement strategy with higher cost, making the planner prefer other actions when available.
Goal Overrides¶
Change a goal's priority or validity conditions for a specific agent:
context.SetGoalOverride(goalInstance, new GoapGoalOverrideEntry
{
Priority = 10f // This agent really wants this goal
});
context.RemoveGoalOverride(goalInstance);
Use case: A boss enemy has "Attack" at priority 10 while normal enemies have it at priority 3.
Belief Overrides¶
Tune belief parameters (detection range, thresholds, etc.) per-agent:
// Via the BeliefSettings container
var beliefSettings = context.BeliefSettings;
// Set an override
beliefSettings.SetOverride(beliefInstanceId, "CustomRange", new MyBeliefSettings
{
TargetKeyId = keyId,
Threshold = 20f // This agent detects from farther away
});
// Check for override
if (beliefSettings.TryGetOverride(beliefInstanceId, out IBeliefSettings settings))
{
// Use overridden settings
}
// Remove override
beliefSettings.RemoveOverride(beliefInstanceId);
Evaluation Priority¶
- Per-agent override (from
BeliefSettingscontainer) — highest priority - Instance DefaultSettings — lowest priority
Use case: A veteran guard has a proximity belief with Range = 20f instead of the default Range = 10f.
Note
Belief overrides change parameters, not the belief's existence in the planner. The belief still occupies the same bit in TagMask128 and uses the same Evaluate() method.
Transition Overrides¶
Enable, disable, or change the condition of an FSM transition for a specific agent:
// Disable a transition for this agent
context.SetTransitionOverride(transitionId, new GoapTransitionOverrideEntry
{
Enabled = false
});
// Re-enable it
context.ClearTransitionOverride(transitionId);
Use case: A berserker agent has the "flee to safety" transition disabled — it never retreats.
Identifying Targets by InstanceId¶
Overrides target specific instances by their InstanceId (a SerializableGuid), not by SO reference.
Warning
Two action instances can share the same strategy SO but have different InstanceIds and different settings. Always identify override targets by InstanceId, not by SO reference.
Bake to New Brain¶
If you've configured overrides during Play mode and want to make them permanent, use the Bake button in the GOAP Hub. This creates a new Brain asset with the overrides baked in as default values.
This workflow is useful for:
- Prototyping agent variations during Play mode
- Creating specialized brains from a base template
- Converting runtime tuning into permanent configuration
What's Next¶
- GOAPAgent Component — The agent context where overrides are stored.
- Performance Tuning — Optimize for many agents with overrides.
- Runtime Debugging — Override badges show which agents have customizations.