
Discover glue architecture and unit design for scalable Unity game projects, guiding advanced developers to compare approaches, reduce code mess, and build a solid architectural foundation.
Explore scene loading and data passing between scenes, including save data and usernames, and compare glue architecture with unit design for UI and flow.
Identify the two biggest architecture problems: changing one component breaks dependencies, and decoupled code lacks context, requiring tests and flow control in Unity projects.
Explore the execution order problem in the game menu, where overlapping animations and event-driven callbacks break flow control, and learn why sequencing animations like first-time coach marks requires controlled callbacks.
Master the glue architecture, a self-contained, box-based approach where features like health and movement stay isolated. Learn code and data separation and the glue's role in scalable Unity projects.
Explore the unit design architecture, a single entry point with a single control that orchestrates decoupled subcontrollers for movement, health, and level, while enabling data-driven identities.
Open the Unity Hub, create a new project with URP using version 26 F1, name the project UnityGame.Essentials, and then clean the project by removing unused items.
Clean a Unity project by removing unnecessary templates and assets, reorganizing input into a sandbox folder, pruning ai navigation, multiplayer, test framework, and visual scripting, and set up Git.
Open the asset store, select a free low poly raft asset, and import it into Unity, then create a third-party assets folder to organize packages and fix pink material issues.
Convert built-in materials to URP to fix pink rendering issues in Macieart scenes, selecting all materials and applying the conversion to render scenes correctly.
Import the fantasy skybox free package and replace the sandbox scene's skybox by selecting fs00 day 01, sunless, and night 01 moonless textures and materials, then delete the old skybox.
Create a base character from a capsule, add a rigidbody and capsule collider, constrain rotations, add a scaled view mesh and a camera as a child, and position everything.
Organize a glue architecture with a first person module, use a namespace to avoid name clashes, and outline head movement, body rotation, and body movement for a first person controller.
Define input and output for a first-person controller: rotate the head with mouse delta on x, rotate the body on y, and move with WASD via a rigid body.
Create the glue architecture folder in the scene and drop the first person character inside to enable easy activation and switching. Implement the first person script as base for movement.
Execute the unit design architecture by creating a character entry point and a non-monobehavior movement controller, using namespaces, serialized subcontrollers, and WASD-driven 3D movement.
Generate a C# input reader class to read inputs like mouseDelta and expose move values, enabling Glue and InDesign integration with the new input system.
Demonstrates building an action reader in the glue architecture to translate raw input into game actions, with a move action bound to W, A, S, D.
Create a character action reader in unit design architecture to translate input system events into a 2d move vector from keyboard, joystick, or gamepad; implement on awake, onEnable, and onDisable.
Define meaningful actions in the glue action reader, bind them to the Unity input system, and read move and look as Vector2, with subscribe/unsubscribe to prevent memory leaks.
Implement the action reader in UD architecture by mapping inputs to move and look actions, subscribing on enable and unsubscribing on disable, then test with the character.
Learn to implement body rotation using the mouse delta (look action) to rotate the character around the Y axis in Unity via quaternion.Euler applied to the transform.
Implement body rotation in Unity by wiring the look action to rotation logic, tracking mouse delta with lookAction.x, and storing the initial y rotation.
Apply a horizontal sensitivity factor to the mouse delta x to reduce rotation. Set a float sensitivity horizontal, such as 0.05, and multiply the delta by this value before rotation.
Apply glue architecture to the first-person system by decoupling the first person and action reader with a dedicated glue that handles their interaction.
Split data from logic in the first-person system using a data container and a scriptable object to hold horizontal sensitivity. Configure and load data to enable runtime changes.
Explore how the UD architecture applies body rotation from the mouse delta, storing a y rotation and rotating a dedicated body transform with a quaternion using the look action vector2.
Multiply the horizontal look input by a sensitivity value to fix oversensitivity in body rotation. Set a float value (0.1f or 0.05) to tune the mouse look and improve playability.
Separate data from logic by introducing a dedicated config data container that feeds movement logic with parameters like horizontal sensitivity.
Shows how to implement head movement in a first-person Unity setup, rotating the head with mouse deltas via the input system and clamping the camera X rotation.
implement head movement in a first-person system by wiring the look action to a head transform, inverting mouse delta for up-down rotation, and clamping rotation to -90 to 90 degrees.
Resolve the vertical sensitivity issue by separating data from logic, updating a data container with vertical sensitivity, and applying it to rotation X for a smoother first-person feel.
Implement head movement for the ud design by converting mouse look delta to x-axis rotation, invert, clamp to -90 to 90, and apply with quaternion dot Euler to head transform.
Add a vertical sensitivity field to the movement data to separate data from logic, multiply look input by this value, and validate improved head movement sensitivity during play.
Translate keyboard input from Unity's input system into a 3d movement vector using local forward and right directions. Normalize input, multiply by speed, and apply as the rigidbody’s target velocity.
Implement raw body movement with a move action and speed in the glue architecture, normalizing direction and applying it in FixedUpdate via the rigid body and inspector.
Fix gravity by preserving the rigid body’s y-velocity, compute the target velocity from move direction, and apply gravity to the resulting velocity in Unity to prevent slow falling.
Build raw movement by computing a move direction vector from move action and transform, then update the rigid body's velocity in fixed update with serialized dependencies.
Preserve the y velocity to fix gravity in a first-person controller by using rigidbody.linearVelocity.y and combining input with right and forward vectors, comparing glow and UD architectures.
Explore how collisions between a character and a cactus trigger a damage trigger that signals the health system to take damage and update the view.
Implement a reusable glue health system with a health component managing current and max values, awake initialization, and methods for receive damage, heal, and revive.
Build a character help subcontroller, wire a health system with current and max, and expose receive damage and heal methods via a constructor for inspector visibility.
Implements a damageable collider for the cactus that detects collisions, checks if the other object has a health system, and calls receive damage with a configurable damage value.
Implement a damageable system in the UD architecture by creating a damage trigger under triggers, detecting collisions, and sending damage to targets via receiveDamage.
Establish a scene controller as the single entry point to centralize scene logic, collecting damage triggers and broadcasting onCharacterEnter to forward damage to the character's receiveDamage.
Implement receive damage logic in the health component, handling early returns and edge cases, updating current health on damage, and integrating with the glue architecture during collision events.
Define and broadcast key game events to track health changes, death, and revival. Implement onHealthChange, onDie, and onRevive to make the component flexible and reusable.
Implement a reusable character health module in the UD with receiveDamage that subtracts damage from currentHealth and handles edge cases, including zero, negative, or when amount exceeds currentHealth.
Broadcast health events using onHealthChanged, onDie, and onRevive to notify listeners when health changes, dies, or revives, by invoking signals with damage values.
separate data from logic by placing current and max in a health data scriptable object and loading them in the health component on awake. use JSON for save and load.
Expose character health as a separate data container using a scriptable object, separating health data (current and max) from logic, and outline save and load via JSON for persistence.
Create a health view UI by converting the image to a sprite 2D, adding a background and a fill bar on a screen-sized canvas, and aligning it to the corner.
Implement a HealthView MonoBehaviour that subscribes to the health system's onHealthChanged event and updates a UI image based on current health over max. This shows view binding and event-driven updates.
Implement the health view in the UTE design, binding character health to the fill image via a computed percentage. Centralize UI resolution through a single scene controller entry point.
Implement a centralized health view by adding a public bind method that connects a character, unbinds the previous target, and delegates binding through the scene controller.
Implement a 0–24 time-of-day clock with adjustable day speed to drive a day and night cycle using Glue and UD, enabling fog, skybox changes, and event handling.
Develop a day and night system as non-monobehavior components with a time-of-day clock, controlled by a scene controller, using serialized time and delta time.
Implement time-of-day events to drive environment changes, such as fog color and fog intensity, and the skybox, by detecting transitions at sunrise, noon, sunset, and midnight with a checkEvents method.
Learn how the scene controller's time-of-day subsystem raises on sunrise, noon, sunset, and midnight events, enabling other components to react via checkEvents and previousTime.
Set up time-of-day events from sunrise to midnight that trigger on every hour change, compute hours, minutes, and seconds with floorTween, and format a user-friendly clock display.
Create an hour-change event that fires as the game clock crosses each hour, using floorTween to detect changes and format time as hours, minutes, and seconds for a clock display.
Create a skybox blend using a custom material to lerp between day and night cube maps. At 18 o'clock, blend from day to night with a shader.
Develop a dynamic skybox system by scripting a blend value to morph between day and night, exposing a serialized material and a shader parameter.
Implement a dynamic skybox for a day and night cycle by wiring a skybox material through a dynamicSkybox controller and illustrating dependency injection in Unity.
Create a day and night glue to drive the dynamic skybox with a time-of-day signal, linking sunrise and sunset to adjust the skybox plan value.
Centralize time of day and dynamic skybox in a day and night controller, wiring sunrise and sunset events to blend the skybox smoothly and manage subscriptions for memory safety.
Implement a smooth day-night skybox transition by lerping the blend over time with elapsed time and next-frame awaits, applying the same logic to the dynamic skybox.
Explore building a dynamic fog system in the glue architecture that lerps fog color and fog density through the day-night cycle.
Implement dynamic fog with a day and night controller and dynamic fog module, lerping fog color and density from sunrise to noon to sunset via renderSettings.
Add the FarmGameUI package from the asset store, import it into your project, and organize it in the third-party folder to enable header, background, buttons, and a slider.
Set up the main pause menu and settings menu using a canvas, header, background, and a vertical layout with buttons and sliders for master and SFX volumes.
Listen to the UI Cancel input to trigger a pause action, subscribe to the input layer, and emit an onPausePressed event through a meaningful game action for pause handling.
Implement the pause action in the UD architecture by wiring the ui cancel input to an on pause event via the character action reader, and pursue decoupling actions from characters.
Move action reader to a scene manager that holds the first person system and inputs, and implement a scene state machine for playing and pausing using init method time scale.
Move the ActionReader to the scene controller with an init method. Build a simple state machine to pause and resume by toggling timescale.
Build a pause menu in the glue architecture with separate controller and view scripts for the gui, wiring a PauseMenuView to a PauseMenuContainer and handling button clicks.
Spawn pause menu UI at runtime within the UD architecture. Separate logic into a pause menu controller and pause menu view with serialized references and require component.
Master a glue GUI pause menu by wiring a scene manager to show and hide the menu, delegating visuals to the view, and toggling player input and cursor visibility.
Instantiate a pause menu prefab on the canvas and implement show and hide in the UD architecture, while disabling player input and toggling the cursor during pause.
Bind the pause menu GUI buttons to view events in Unity, routing resume, settings, and quit through a controller while subscribing and unsubscribing button listeners.
Instantiate the pause menu prefab, bind its buttons, raise events, and use an async show with TaskCompletionSource to await and return the user decision (resume, settings, main menu, quit).
Create a settings menu using the glue architecture by establishing a settings menu core and view, binding the controller to the view, and wiring components for a reusable GUI base.
Create a base settings menu in the UD architecture by adding a settings menu script and view, linking them with a serialized reference, and converting the menu to a prefab.
Implement show and hide for the settings menu, wire it from the pause menu within the glue architecture, and use a settings container game object to toggle visibility.
Implement the UD GUI show flow by instantiating the settings menu from the pause menu, wiring show/hide methods, and coordinating with the scene controller.
Bind the settings menu buttons and sliders in Unity, creating listeners and events for on save click and on master volume change, with awake and destroy lifecycle binding.
Handle settings menu interactions by binding the save button and volume sliders to onValueChanged events, wiring awake and disable lifecycles, and signaling changes through onSave and onMasterVolumeChanger for updates.
Organize assets into background music and sound effects, set up 3D audio sources, and build an audio mixer with exposed master, bgm, and sfx volumes for runtime control via scripts.
Connect the settings menu to the audio mixer to control master, bgm, and sfx volumes by translating 0–1 input to minus 80 to 0 dB and applying with the mixer.
Wire the settings menu to the audio mixer, updating master, BGM, and SFX volumes by slider input, mapping 0–1 to minus 80 dB–0 dB in real time.
Define a settings menu result to return master, BGM, and SFX volumes from the settings menu to the pause menu, using a task completion source and an async show method.
Extract an async handlePauseUserInteraction to manage pause, settings changes, and resume without invalid operations. Re-enter the flow on settings changes to ensure a smooth, reliable GUI experience.
Scalability is one of the biggest problems in Unity projects. The unimaginable amount of freedom and lack of clear guidelines can lead us to complex systems interacting in such a way that no human brain can handle it. In a project with 10,000+ lines of code, every single change can be a high risk of breaking another component, with endless edge cases emerging with every new feature.
Especially if you are a small studio or a solo developer, this course can be the key to avoiding this problem and gaining confidence in building complex, solid Unity projects. In this course, we will develop a simple survival game using two different scalable architectures.
Introduction:
Here we will dive deeper into architecture problems, explore the proposed solutions in this course, and understand in which scenarios each one is better than the other. What is flow control? What is glue? These concepts are presented here.
Creating and Understanding the Project:
We will quickly prepare everything we need to dive into the code. We will create the project, add visual assets, and prepare the scene.
Handling Gameplay Features - Movement:
At this point, we will have our first contact with both architectures. We will discuss and build together a First Person Controller, handling movement, reading inputs, splitting the problem into small pieces, and solving each piece. We will also learn how to separate data from logic.
Handling Gameplay Features - Health:
Here we are going to discuss and implement the Health System. Why? Because it is a feature that involves triggers and interactions between the Player and the environment, and we'll see how differently these interactions are handled between the different architectures.
Handling Gameplay Features - Day and Night Cycle:
Time, Skybox, and Fog are different components that we will combine into a system that will work as the Day and Night Cycle of the game. This is where we will find a few similarities between Glue and UD, explore the idea of dependency injection, and much more.
Handling GUI:
Finally, here you will understand the full power of the UD architecture. We will build a simple Pause and Settings Menu that will enable the player to control the Mixer (Volume) of the game. How to handle user interactions? How to separate view from logic? We are going to dive into these questions at the end.
Do you prefer flexibility and speed? Or do you want full control of your project?
Get this course, learn them both, and decide.