Sitemap

CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Follow publication

Member-only story

Making a RTS game #5: Transforming our data into Scriptable Objects (Unity/C#)

9 min readApr 8, 2021

--

⬅️ Tutorial #4: Selecting units | TOC | Tutorial #6: Improving the UI ➡️

📕 Get the ebook and bonus material on Gumroad!
🚀 Find the code of this tutorial series on my !

Today, we’re going to see how to store data into Scriptable Objects, rather than defining them directly in our scripts.

At the moment, our data is defined in our global variables — and those global variables are of two types:

  • some are “external” data that we want the game to be aware of and use during the loading phase when it starts
  • others are utilities shared across of all scripts and internal to the game logic

The second type of variables should stay as is — there is no point in loading the reference to the “Terrain” layer from an external data source, for example. On the other hand, our building types could be loaded from another source: they are not determined by the game state. The list of in-game resources is somewhere in-between: though the notion of “gold”, “wood” and “stone” as resources could be loaded up, remember that our…

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)