NPC Speech Bubbles
NPC Speech Bubbles are world-space UI panels that float above characters and display short contextual text when the player is nearby. They provide ambient storytelling and gameplay signposting without requiring a full dialogue interaction — an NPC might say "Have you seen the blacksmith?" when you walk past, shift to "Please, find my missing cart!" once a relevant quest is active, and go silent after you've already spoken to them.
The system is built from two cooperating parts:
NPCSpeechBubble — a per-NPC MonoBehaviour that owns the bubble content, proximity detection, and conditions for what text to show.
SpeechBubbleManager — a scene singleton that coordinates all active bubbles, caps how many are visible at once, and handles object pooling so bubble UI instances are reused rather than instantiated and destroyed at runtime.
Text content is driven by Text Variants — a list of conditional text entries evaluated in priority order each time the bubble activates. Conditions can gate variants on quest state, dialogue flags, and objective progress, so the same NPC can say something different depending on where the player is in the story. If no variant condition matches, a configurable Default Text is shown instead.
Bubbles respond to proximity: each NPC defines its own activation and deactivation distances, with optional hysteresis to prevent flickering. Line-of-sight checking is also supported. The Manager enforces a global cap on how many bubbles can be visible simultaneously, prioritising the NPCs closest to the player when the limit is reached.
The detail for each component — all properties, conditions, events, and the Manager's pooling and prioritisation settings — is covered on the next pages...
Last updated