CODEX

RTS Interlude #1: Introducing an event system (Unity/C#)

On with our RTS project — in this interlude, we’re going to talk about events!

Mina Pêcheux
CodeX
Published in
7 min readMar 26, 2021

--

⬅️ Tutorial #3: Setting up in-game resources | TOC | Tutorial #4: Selecting units ➡️

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

So far in this series, we’ve set the scene for several big features and used a little palette of tools that Unity and C# provide: the new UI system, raycasting, game object instantiation, resources loading, material switching, global variables and basic data encapsulation… There is however something fundamental in video games we haven’t yet talked about: events.

Overall, programs can follow various paradigms in terms of instructions execution, data layout, components hierarchy and communication, etc. In video games, it is very common to have an update loop that runs continuously (more or less every rendering frame) and checks with all the systems in the game if they need to do or return something. In Unity, this built-in structure is visible through the Update() method that's available in every MonoBehavior-derived class.

--

--

Mina Pêcheux
CodeX
Writer for

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 :)