6 min read
Mastering the Breath System in V2.0 – Oxygen Management Made Easy

Version 2.0 of the Modular Third-Person Framework introduces a fully modular Breath System — designed to integrate seamlessly with swimming and diving mechanics. Whether you're building survival gameplay, stealth missions, or underwater exploration, this system gives you a plug-and-play solution for managing oxygen with minimal setup and maximum control. 

🔗 Breath Integration Across Movement StatesThe Breath System is tightly coupled with movement states — no extra wiring needed. 

  • Swimming & Diving: Breath decreases naturally while underwater.
  • Recovery: Surfacing or exiting breath-consuming states restores oxygen based on configurable rules.
  • Inheritance: Implemented in PlayerBreath, which inherits from BreathBaseSystem, ensuring consistency with stamina and health systems.

 Need underwater survival mechanics? This system is already wired and ready to go. 


⚙️ Configurable Breath BehaviorControl every aspect of oxygen management using the BreathConfig ScriptableObject: 

  • Max Breath – total oxygen capacity
  • Recharge Timeout – delay before breath starts regenerating
  • Recovery Rate – how quickly oxygen refills
  • Deplete Timeout – delay before breath starts draining
  • Drain Rate – how fast oxygen is consumed

 All values are editable at runtime, making iteration fast and flexible.Want to tweak gameplay without touching code? Just adjust the config. 


📡 Event-Driven Oxygen TrackingThe system uses delegates to broadcast breath changes: 

  • OnBreathChanged – updates UI elements like oxygen bars
  • OnOxygenOut – triggers gameplay consequences (e.g., health drain)

 No need to write custom logic — just subscribe to the events. 


🖥️ UI Integration – Clear Feedback for PlayersBuilt-in support for real-time UI updates ensures players always know their oxygen status. 

  • PlayerBreathUI: Implements IPlayerUI and extends PlayerUIBaseSystem
  • Dynamic Updates: Breath changes auto-update the UI image fill amount
  • Show/Hide Controls: Toggle UI visibility based on underwater states
  • Custom Hooks: Use OnUIShown and OnUIHidden to trigger sounds, animations, or effects

 Give players clarity without building a custom UI system. 


🧠 Architecture Overview 

  • MonoBehaviour: PlayerCoreOrchestrator – centralizes logic
  • Breath System Script: PlayerBreath – manages oxygen logic
  • Base Class: BreathBaseSystem – shared logic across entities
  • Configuration: BreathConfig – ScriptableObject for tuning
  • UI: PlayerBreathUI – connects breath logic to the HUD

  

 Quick Setup Checklist 

  • Create a BreathConfig asset and assign values
  • Attach PlayerBreath to the player (already wired via orchestrator)
  • Add PlayerBreathUI and link a UI Image (oxygen bar)
  • Bind breath events (OnBreathChanged, OnOxygenOut) to feedback
  • Test underwater scenarios to balance drain/recovery timings

  

🎞️ Notes on AnimationsAs with all systems in the framework, the Breath System is code-only. Developers should: 

  • Add visual feedback for drowning or breath recovery
  • Sync animator transitions with state timeouts for smooth feedback

  

🧩 Final NotesThe Breath System in V2.0 gives developers a flexible, event-driven way to simulate oxygen. With ScriptableObject-driven parameters, seamless integration with movement states, and built-in UI support, it’s a lightweight but powerful addition to immersive gameplay.Need breath mechanics for stealth, survival, or underwater levels? This system saves hours of setup and scales with your project.


👉 Get the Modular Third-Person Framework on the Unity Asset Store: https://assetstore.unity.com/packages/templates/systems/versatile-third-person-controller-system-281833
👉 Already using the framework? Share your experience — leave a review here: https://assetstore.unity.com/packages/templates/systems/versatile-third-person-controller-system-281833#reviews

👉 [Documentation Hub – High-Level Overview + System Architecture]: Unity Game Development Docs | True Tactical Studio

Comments
* The email will not be published on the website.