I covered so many things in terms of knowledge for the Voxel Towns project! Mainly, a mix between Unity Editor features and C# Programming all in-depth. Plus tons of side projects along my learning journey, let's have a look!
Unity Features
Render Pipeline
Which one suit the project the most between these pipelines, 3D Core (Unity Built-in Render Pipeline), URP (Universal Render Pipeline), or HDRP (High Definition Render Pipeline)? In this project, URP is the best.
API Compatibility Level
Difference between .NET Standard 2.1 and .NET Framework, for this project .NET Standard 2.1 is the way to go.
Scripting Backend
IL2CPP for iOS and Mono for Android work best.
Ragdoll
One of the coolest features in the gaming industry!
Cinemachine
The camera is an essential piece of object in the game that players can see and interact through it, so it's important that I learned all of these types which consist of the following, Follow Camera, Freelook Camera, Dolly Camera, CCTV Camera, Target Group Camera, State Driven Camera, and much more.
New Input System
A more extensible and customizable alternative to Unity's Built-in Input system. There are so many ways to script this API to work in Unity, the best way that not many tutorials out there are using, is with the interface which is the best in terms of performance and maintenance ease.
Complex UI System
There are lots of well-known components that we all use for manipulating UI in Unity but some are not so well-known which in my opinion are as the following, Nested Layout Group with a combination of Horizontal Layout Group, Vertical Layout Group, and Grid Layout Group. The layout Element component is so useful to directly control some UI aspect ratios, especially when inside a Nested Layout Group. Aspect Ratio Fitter and Content Size Fitter as well.
Animation Event
To call a method at a specific point in animation time frames so we know when exactly it happens and can do so many cool things from there. An example of this would be when an attack animation, at the exact hand movement swing we can add an animation event to call a method to play sound, reduce health, spawn VFX, etc.
Timeline
To sequence all of the Animation Clips and create coordination among multiple GameObjects in the Scene. Can be thought of as the director of the Scene. What makes it different from Animation Window is that it can control multiple GameObjects in a Scene at once. This is so handy to create cutscenes, cinematic sequences, and more.
Post Processing
This feature really makes the game pop out, its use is to show all the powerful effects in the game like Vignette, Bloom, Ambient Occlusion, Auto Exposure, Color Grading, and much much more!
Collision
More in-depth about the collision, the way to make it registers is quite complex because we have to deal with different settings of the collider and rigidbody components to make it registers with collision or triggering as there are two options out there. With kinematic or without kinematic, with trigger checkbox or without, all of these have to be considered for both sides with their difference in combination returning a different outcome.
Scriptable Objects
A collection of data that is useful to use as an inventory item, quest list, special ability, and much much more.
Asset Database
Custom Editor as Inspector
Custom Editor as Window
Window Pop-Up Menu
A more advanced feature that developers can do with Unity is a custom editor window. It took me around a month or so to build, but it's worthwhile in the long term because it's so easy to create dialogues for characters in the game using each node, and also improves creativity drastically. Each node is a scriptable object which can be dragged around and arranged sensibly.
C# Coding Commandments
Thy classes shall be Highly Cohesive
Thy classes shall be Loosely Coupled
Thou shalt use Composition over Inheritance
Composition is more FLEXIBLE & REUSABLE than Inheritance. Try to use Composition as MUCH as possible. Try to use Inheritance as LITTLE as possible.
- Inheritance Problem: sometimes a class wants to inherit from multiple places, but C# is not allowed. For example, platypus IS part of mammals & reptiles, but this is not possible to do with inheritance to inherit from both parent classes.
- Composition Solution: add different components, and the combination of those gives its actual functionality. For example, a platypus HAS a MilkMakingComponent (from Mammal) & an EggLayingComponent (from Reptile), job done!
Thou shalt follow the Law of Demeter
C# Solid Principle
(S) Single-responsibility Principle
“Having a class responsible for just one thing.”
(O) Open-closed Principle
“Open for extension, but closed for modification.” - make things easy to change by adding functionality through extension, but hard to break by keeping it closed for modification.
(L) Liskov Substitution Principle
“Subclasses should be substitutable for their base classes.” - sometimes subclasses did change something that we don’t know so when we substitute the subclasses for equality they aren’t equal.
(I) Interface Segregation Principle
“Many client-specific interfaces are better than one general purpose interface.” - splitting out interfaces for different clients, is more reusable. An example would be IHealthDisplay and IDamagable.
(D) Dependency Inversion Principle
“Depend upon Abstractions. Do not depend upon concretions.” - Instead of Game Code depending on sub-systems directly, Game Code depends on Interfaces. Then let the sub-systems implement the specific Interface. Now swapping sub-systems become so easy without modifying the Game Code.
C# Programming Patterns
Observer Pattern
Commonly used in a situation, one-to-many dependency. The Subject Class doesn’t need to know who, those Subscriber Classes are, like fire and forget situation.
Dependency can be flipped, instead of class A calls class B’s method (A -> B). We do, class A creates an event for class B to subscribe. (now B -> A).
Strategy Pattern
Decorator Pattern
Composite Pattern
These work altogether as a Trinity. Also serves as an Open-closed Principle. Commonly used examples are Ability System or Any Program that wanna act like Lego Bricks, or Behaviour Trees. A class that does something in a lot of different ways, extract all of those algorithms out into their separate classes and make their classes' object interchangeable.
Finite State Machine/State Pattern
Great for systems where you have different states that you could be in, one state at a time (mutually exclusive). Input is the thing that will change the state. Finite State Machines focuses on transition-centric whereas State Pattern focuses on state-centric. Commonly used for AI behavior, or Character Locomotion (Grounded state, Crouching state, and InAir state).
Object Pooling Pattern
Instantiate many objects at the start (can use start time to do expensive things), then enable & disable them instead of Instantiate & Destroy them over and over again. Useful for making Projectiles, UI Elements, or Any Sort of GameObjects that need to Spawn & Destroy Often.
Singleton Pattern
Unity commonly used situation, a class to work across scenes. Like a central audio player, responsible for crossfading the audio between scenes.
MVC, MVP, MVVM, MVPR
These don't belong to C# but I added it here since in Unity it plays a vital role in manipulating tons of scripts in referencing all the UI per scene. MVPR is an improvement upon MVP that I invented and is currently used among the projects.
C# Advanced Topics
Generics
Delegates
Lambda Expressions
Events
Extension Methods
LINQ
Coroutine
IEnumerator (Unity Asynchronous Programming)
IEnumerable
IQueryable
Action, Func, Predicate, UnityAction, UnityEvent, EventHandler, Comparison, Converter, and more!
Side Projects Overview
RPG Prototype (~7 months)
Action Combat (~2 months)
Other Projects & C# Programming (~4 months)
Comentarios