How to use events to implement a messaging system in Unity/C#

Let’s see how to use C# events to broadcast messages and decouple our game systems!

Mina Pêcheux
Geek Culture
Published in
12 min readAug 1, 2021

--

🚀 Find all of my Unity tutorials on Github!

This tutorial is available either in video format or in text format — see below :)

Why events are a neat trick for games

As I’ve discussed in other articles, C# events are a very powerful tool that is great for making more robust projects. In particular, they reduce the entanglement between the various systems in your project and help with decoupling.

Events are a way of maintaining communication between your game systems while keeping a nice separation of concerns: everyone does their own thing, but they can send messages to the others and be part of this big ecosystem.

It’s a great way of having your components be more autonomous and handle their logic logically but still be well incorporating in a larger project.

--

--

Mina Pêcheux
Geek Culture

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