Today we will tackle something easier as the subject of Scriptable Objects in Unity is fairly straightforward. What is so cool about them is that you can throw so much different thing in them!
What Scriptable Object is?
According to the definition provided by Unity, Scriptable Object is a data container that let you save a lot of data and reduce memory usage. You can create them from code or by making new instances in the project view.
Thanks to that you can easily create a lot of different representation of data, for example, inventory items, skills, game modes and more.
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 stands for Model – View – Controller 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.
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.
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. ?