Conversation Policies
Conversation policies control the side effects of entering and leaving a conversation -- what gets paused, what gets blocked, and when a conversation should end.
The system uses five policy interfaces, each responsible for one aspect of conversation lifecycle management.
The five policy types
IConversationEndPolicy
Determines when a player conversation should close for reasons other than reaching an end node. For example, a policy might close the conversation when the player looks away from the NPC for too long.
The built-in implementation is SettingsDrivenConversationEndPolicy, which reads its behaviour from module settings.
IConversationPlayerControlPolicy
Controls whether the player can move and look during a conversation. The built-in implementation, StarterAssetsConversationPlayerControlPolicy, disables player movement and look input when a conversation opens and restores them when it closes.
IConversationWorldPausePolicy
Controls whether the game world pauses during a player conversation. SettingsDrivenConversationWorldPausePolicy reads its behaviour from module settings, allowing you to toggle world pausing without code changes.
IConversationCursorPolicy
Controls the mouse cursor during conversations. SettingsDrivenConversationCursorPolicy reads its behaviour from module settings:
- Manage Cursor During Dialogue -- whether the policy should change cursor state at all
- Show Cursor During Dialogue -- whether the cursor is visible during conversations
- Cursor Lock Mode During Dialogue -- the lock mode to use (typically
Noneso the player can click options)
On conversation open, the policy shows/locks the cursor as configured. On close, it restores the previous cursor state.
IConversationAgentControlPolicy
Controls whether agents are paused during conversations. This policy uses a multi-registration pattern -- multiple policies can be registered and they are all evaluated through a composite resolver.
When CIVIL-AI-SYSTEM is installed, the integration layer automatically registers CivilConversationAgentControlPolicy. This policy pauses the agent's CivilAI behaviour tree when a conversation starts and resumes it when the conversation ends. Without CivilAI, a no-op fallback is used and agents continue their non-dialogue activity during conversations.
The resolver pattern
ConversationEndPolicyResolver and ConversationAgentControlPolicyResolver aggregate multi-registered policies into a single composite. This means you can register additional policies alongside the built-in ones without replacing them.
For example, you could register a custom agent control policy that also disables navigation alongside the CivilAI policy that pauses behaviour trees. Both would run.
No-op defaults
Each policy type has a no-op implementation that does nothing. When no specific policy is registered (for example, when running Dialogue standalone without CivilAI), the no-op version is used automatically. This means the system always has valid policies and does not need null checks.
Providing a custom policy
To add a custom policy:
- implement the relevant policy interface
- register it in a module registrar using
RegisterMulti(for agent control and end policies) orRegister(for player control and world pause) - the system will pick it up at initialization
Custom registrars should use an order higher than 200 (the dialogue registrar's order) to ensure dialogue services are available.
Practical advice
The default policies work well for most setups. The most common customisation is adjusting the world pause behaviour through module settings rather than writing code.
If you need a conversation that does not pause the world (for example, a quick one-liner exchange), consider configuring this through the policy settings rather than removing the policy entirely.
Next step
Continue to Input System.