Friday, July 31, 2026

ScriptableObjects In Unity And The Hidden Superpowers Most Overlook


When you first encounter ScriptableObjects, it's usually introduced as a way to store data outside of a scene. You create an asset, fill in some values in the Inspector, and suddenly you've got a cleaner alternative to hardcoded variables.

But that's only scratching the surface. It can do more than just hold data!

ScriptableObjects is one of Unity's most powerful and often misunderstood feature. If used correctly, it can simplify your architecture, reduce dependencies, improve reusability, and make your project significantly easier to maintain as it grows.

Unfortunately, it also has a reputation for being overengineered. Spend enough time on Unity forums, and you'll eventually find someone suggesting ScriptableObjects as the solution to virtually every problem. Need an inventory? ScriptableObjects. Dialogue? ScriptableObjects. AI? ScriptableObjects. Coffee machine broken? ...okay, perhaps not that one.

Like any tool, it's at its best when solving the right problem.

Let's deep-dive into what ScriptableObjects really are, when/how/why you should use them, and when it's definitely not the answer.

Thursday, July 30, 2026

Don't Ditch Coroutines for Async/Await in Unity Until You Read This

If you've only ever worked with coroutines, switching to async/await can feel almost magical. The code is cleaner, easier to read, and behaves much like synchronous code.

However, there's an important difference: Tasks are a .NET feature. Coroutines are a Unity feature.

That distinction affects how they interact with Unity's object lifecycle, scene management, and exception handling.

These differences are responsible for many of the mysterious NullReferenceExceptions and "WTF it worked yesterday!!" bugs that developers encounter when first adopting async.


Tasks don't adhere to Unity object lifetimes

This is arguably the biggest gotcha.

Imagine you write a simple async method to open a door:


public async Task OpenDoor()
{
    await Task.Delay(3000);

    animator.SetTrigger("Open");
}
  

Everything works perfectly until the player changes scenes, or destroys the object...or exits play mode. Three seconds later, the task resumes anyway. Now animator no longer exists.

NullReferenceException

You may wonder:

"The GameObject was destroyed. Why is this code still running?"

Because Tasks have no clue what a GameObject is. They're managed entirely by the .NET runtime.


Wednesday, July 29, 2026

Coroutines vs Async/Await vs Awaitable in Unity: Making Sense To Modern Asynchronous Programming

Coroutines have been pretty much the backbone of asynchronous programming in Unity for a long time. When you need to spawn enemies, fade a UI, load a level, or create cinematic sequences, chances are you wrote countless methods returning IEnumerator.

However, Unity has other options regarding this that may be better for your project.

Modern versions of Unity embrace C#'s async/await programming model and, more recently, introduced Awaitable, a Unity-specific asynchronous API that integrates directly with the engine. These additions don't replace coroutines outright but they complement them and, in many situations, offer cleaner, safer, and more powerful alternative.

Perhaps the challenge for many Unity game developers isn't learning the syntax, it's knowing which tool is better for the task at hand.

Let's take a deep-dive into Coroutines, async/await, and Awaitable, including threading, Task.Run(), CancellationToken, AwaitableCompletionSource, performance considerations, and strategies for migrating existing coroutine-based projects.

Tuesday, December 23, 2025

Singleton Game Design Patterns Done Right in Unity (With Code Examples)

Ahh, Singletons... probably one of the most debated game design patterns in Unity development. A quick Google search often reveals two camps. Those who swear by it, and those who avoid it like the plague. 

Not that long ago, I was in the latter camp. But ever since I ran into some issues, I'm switching back to the other side. Now, how do you use persistent and non-persistent Singletons effectively in Unity?

 

 

Let’s first briefly go over what a Singleton is for those unfamiliar with the concept.

 

Friday, December 19, 2025

Overengineering Code in Unity: When Good Game Architecture Can Become a Problem

Back in September of this year, I wrote an article about decoupling game systems in Unity with an EventBus. This is a crucial part of  game architectural design, and should be implemented in those areas of your project that make sense. Once you understand it, you're probably eager to implement it everywhere! But be aware that this can also lead to some unwanted results in your project.