
Explore coding conventions, preferences, and habits for Unity C# development, featuring vim-driven editing, underscore private variables, properties, namespaces, and modular state-machine oriented design.
Download and install Unity via Unity Hub and create a universal render pipeline project. Explore scene, hierarchy, view, assets, and package manager; configure input system and git in VS Code.
Import the 2D sprite package and golden chest animations from the pixel art platformer, organize assets in a third party folder, and prep the chest textures in the sprite editor.
Drive unity animations by crossfading between idle, walk forward, and walk back based on w input, while illustrating how a clunky spaghetti approach motivates a state machine.
Add an eat animation to the bear by pressing E, crossfading via the animator, and expose the messy, hard-to-scale state logic that motivates exploring state machines for cleaner design.
Learn to build a 2d character driven by a state machine, create an assets-based Unity URP scene, import sprites, slice frames, and craft an idle animation with the character animator.
Slice a walk sprite sheet into eight frames, create walk and idle animations in the animator, and wire input to switch between them while laying groundwork for a state machine.
Implement a serializable state machine in Unity, add states by mapping names to implementations, and expose a public owner property so states can trigger transitions.
Create a utility to generate boilerplate state scripts for Unity state machines, reducing repetitive code by using a template and a custom create state script utility.
Implement a bear state machine in Unity, adding idle, walk forward, walk back, and eat states, wiring transitions, and animator crossfades to drive animations via input.
Import the jump sprite, slice the image, create a jump animation from two sprites, and apply it in the animator to implement the jump state.
Add a jump state to the Unity character state machine, reading the jump action, playing the jump animation, and applying vertical velocity with transitions from idle and walk when pressed.
Implement a crouch state by dynamically resizing and offsetting the capsule collider 2d during crouch, then restoring it when standing, and connect these changes to movement and velocity.
Import run sprites, set 16 pixels per unit, slice into eight frames, create a run animation, and attach it to the player animator beside the walk, removing the run animator.
Create a push hands object as a child of the player with a hands collider to push boxes using Unity physics, tuning a 2D box collider's size and offset.
Create a pushable box in a 2D Unity scene by implementing the IPushable interface on a MonoBehaviour, using Rigidbody2D and BoxCollider2D, with mass toggling between 50 and 2 during push.
Learn to implement a push state in Unity using a hand collider, enable/disable logic, and precise transitions between idle and push, including push speed and animation control.
Create an I pullable interface and a pullable point as monobehaviours, using a fixed joint 2D to connect the player's rigidbody when pulling, and adjust mass for push/pull states.
Learn to implement a pull sensor in Unity by using a box collider trigger, sensor layer management, and trigger enter/exit logic to detect pullable objects and broadcast changes.
Connect the pull sensor to the character by wiring a serialized sensor reference, then listen for pull events and update the character sensor data with the pullable.
Implement ladder climbing in Unity by entering a climb state with the W key and stepping up or down via four animation events, wiring public methods to those events.
Fix ladder collisions by ignoring the default layer and using the obstacle layer, add a sorting group, and implement a ladder script with bottom and top points and gizmos.
Learn to bind and sync Unity animations with scripts using animation events, create a character animation events script with public methods and events, and wire end-of-animation listeners for sequencing.
Master state machines in games by exploring jump, walk, and run behaviors, sensors, and artificial intelligence in Unity, using rigidbodies, colliders, and scalable design.
Say goodbye to spaghetti code, no more floating variables intercommunicating for reasons that you cant remember the day after. State Machines is a powerful technique that will allow you to avoid spaghetti code, make it scalable and easier to maintain.
Learn techniques that professional Game Developers from Industry are vastly using to create complex games.
This course is designed for game programmers that want to create really scalable code using techniques that are vastly used in many AAA games that you have played.
Not only learning how to implement State Machine in any of your games but during this course you will learn a lot of cool tips, techniques and ideas on how to architect your code, how to write code that is easier to maintain and scale, useful insights and a little bit of philosophy that will make you a more mature developer.
Introduction - Here I will explain more about the idea of state machines, present a few of my coding conventions and habits that can be useful for you and will install and have an overview in the Unity Editor.
Chest Example - In this section I will create the most basic example that we can (later) apply state machines. Here we still don't know about state machines but this is not an excuse to discuss and write GOOD code.
Bear Example - Here you will learn what a bad code is. We will implement the behavior of the Bear using spaghetti code to the point it is unproductive and you will be asking "okay, I got it but what can we do about it?"
Character Example - At this point we are preparing the ground to dive into State Machines but first we need some base thing to control and some code architecture to use
State Machine Implementation - Create a simple and reusable code to use in this project and in any other Unity C# project that you want.
Refactoring with State Machines - Lets reopen the Chest example and now refactor it using our new knowledge of State Machines.
Character Example (Part 2) - This is the core of the course, here is where you will definitely learn state machines applying over and over again until you are tired and the concept is in your head.
Final Challenge - Now that you are used to State Machines we are going to develop a more complex case using it so you can cover more different details to be able to cover the need for your games.
By the end of this course you will be tired of hearing the word "State Machine" but happy to have this new ability to implement anything in your mind.