
Course Image was designed by Freepik.
The slides are attached as a resource
The Exercise is attached as a resource
Implement a singleton in Unity by declaring a private static instance, exposing a getter without a setter, and using Awake to enforce a single instance and log duplicates.
Illustrates how game managers use the singleton pattern to control essential, high-level game systems such as win and lose conditions, timing, pausing, level loading, and spawning.
Learn how a singleton streamlines accessing a single game manager, enforces one instance, and can persist across scenes. It also notes lazy instantiation and dependency injection for larger projects.
You can download the Slides from the attachment
You can find the Example project in the attached .zip-File. Also the instructions for the exercise can be found in the .pdf.
Compare object pool patterns in Unity, showing how none, array, list, and queue pooling affect instantiation costs, script performance, and frame rates using the Unity profiler.
Learn how queues implement a first-in, first-out object pool by enqueuing at the back and dequeuing from the front, and why a queue suits pooling better than a list.
Switch the object pool from a list to a queue, using enqueue to add and dequeue to retrieve the front item, for a cleaner Unity pooling pattern.
Explore lazy instantiation in the object pool pattern by dynamically resizing the pool on demand, instantiating new bullets only when needed, to reduce memory usage and boost shooting performance.
Apply the flyweight design pattern to manage huge numbers of game objects by sharing data like max HP and move speed, while storing current HP per instance.
You can test the different apporaches yourself in the attached project.
Learn common ScriptableObject pitfalls in Unity, including proper instantiation without new, serialization of custom classes, and keeping ScriptableObjects as data containers rather than functional logic.
You can find the project of the video in the attached .zip-file.
Leverage scriptable objects to define bullet stats like speed and damage, and reference them in player and enemy behavior in Unity to improve flexibility and performance.
Explore the command design pattern and its use in game programming, including runtime controller remapping, queuing actions in real-time and turn-based games, and undo/history capabilities.
The project I'm working on in this video can be found in the next video where you will be challenged with an exercise.
In order to do this exercise you need to download the instructions and the demo project.
In order to do this exercise you need the demo-project from lecture 22: Exercise - Remappable Input
implement a clean command queue for the player, adding move up, down, left, right and attack commands, executing them in order with completion events and preparing for undo.
Explore how the command design pattern handles complex input across games, switching the active invoker for cars and players and coordinating shooting and reloading.
In order to implement this exercise you need the finished Version of Exercise2: Queue Commands.
Implement undo functionality in the command pattern by checking current command index, updating is executing command, calling Undo, and firing on undo completed to refresh history UI.
Be sure to visit my Youtube-Channel:
Sqrly Code: https://www.youtube.com/channel/UCQw56bJGe1iW-cLAfIBXdVg
For more Designpatterns for Gamedevelopment visit:
gameprogrammingpatterns.com: http://gameprogrammingpatterns.com/contents.html
If you already possess a fundamental understanding of C# and the Unity Engine and want to improve your coding skills further, then this course is for you.
The Ultimate Guide to Unity Designpatterns introduces you to best practice solutions for common problems in gameprogramming. You will discover how you can improve the quality of your code by using these important Designpatterns, which are specifically adapted to make use of the unique features of the Unityengine, like for example ScriptableObjects.
In this course you will:
Implement best practice Solutions to common problems in gameprogramming
Discover the Singleton - Designpattern
- Structure your game more elegantly
Discover the ObjectPool - Designpattern
- Improve the performance of your game
Discover the Command-Designpattern
- Implement a history of player-actions with an Undo-Functionality
- Queue Actions of a player, so they are executed one after another
Discover the Flyweight - Designpattern
- Improve your game's data-structure by using ScriptableObjects
- Reduce the RAM-Usage of your game
This course is very project-based and practical, so you will implement the concepts directly in small games.
For each Concept you will be challenged to implement it yourself, but if you don't feel up to the task you will also be shown a well explained step-by-step guide how to implement it.
The course also features several Demo-Projects, where you can look up best practice implementations.
It also features Projects which are specifically designed to compare the performance of different approaches for implementing these Designpatterns.
Why learn from me?
I have been a game-programming teacher for more than 5 years now and as a result have plenty of experience in what works and what doesn't when teaching programming. Also I am a firm believer, that you can only learn the high craft (some might even say art) of programming, if you practice it. Which is why I put much effort into making the advantages of these designpatterns clear by giving you small practical assignments where you are challenged to improve an existing game's code with these designpatterns.
Become a better Programmer, now! I'll meet you inside the course!
Who is the target Audience?
Unity users who want to improve their programming skills beyond basic tutorials
Programmers who want to improve the Performance, Quality and Expandability of their Code
Coders who want to add a few battle-proven solutions for common problems in gameprogramming to their toolkit