Simple MVC for Unity

There are a lot of different implementations of MVC design pattern available for Unity, but I’ve noticed one problem with most of them.
They require a lot of knowledge about programming in general, and some of them use some fancy techniques which unnecessarily complicates your code.

And who wants to have hard to read and maintain code? ?

MVC

MVC stands for ModelViewController and is one of most used design pattern in IT, but not necessarily in Game Dev. This design pattern is used to separate your code based on use.

Here we have three parts of this pattern:
Model – these are classes responsible for storing and handling data.
View – these are responsible for handling displaying data and receiving input from the user.
Controller – and these are responsible for the logic behind the app in general. They also handle respond to the input from view, and they are passing data into views.

Continue reading “Simple MVC for Unity”

Localizing your game in Unity

Nowadays it’s rare to create games with only one language available for a player. So today we will tackle localizing games in Unity using Singleton Design Pattern and Data Serialization.

Why should I care?

I know that we are living in a world where the English language becomes a standard mean of communication, but there are still people that don’t speak English! So the only way to get to them is to make a game available in their native language.

Continue reading “Localizing your game in Unity”

Data Serialization in Unity (JSON friendly)

As programming is all about what you are doing with data, I thought that it would be a good idea to speak about data serialization in Unity. Especially that now we can turn data objects into JSON with JsonUtility! ❤️

What is so special about that?

Data serialization is essential for games for a variety of reasons. Saving and loading player progress or saves, sending and receiving data from a server, and in general converting data to and from a text or files. ?

Continue reading “Data Serialization in Unity (JSON friendly)”

Singleton in Unity – Love or hate?

Those who know me, know that I have a rough relationship with the Singleton Design Pattern. Mostly I don’t like using it very often or even at all. This approach has a lot of benefits, starting with cleaner code architecture, less coupling, and in general fewer problems. ?

When to use it?

So when you would implement singleton? When you would like to have only one instance of a specific object. Example of what could be a custom resource manager where you store or load files that you downloaded from the web or any other data storage.

Continue reading “Singleton in Unity – Love or hate?”