Making a RTS game #21: Adding players and unit ownership (Unity/C#)

Today, let’s add some players and an ownership system to our RTS!

Mina Pêcheux
.Net Programming
Published in
13 min readJul 29, 2021

--

⬅️ Tutorial #20: Saving the player’s data properly| TOC | Tutorial #22: Producing some resources with our buildings ➡️

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

The last tutorials have been about game parameters and UI displays of our settings — we’ve been working on the metadata of our game quite a lot. But it’s been a while since we haven’t added a quick-win feature: something quick to implement but essential to the game.

In this episode, we’re going to see how to create a list of players for the current game, and how to associate units to players through an ownership system.

Prelude: simplifying our GameParametersEditor (a lot!)

In recent episodes, we’ve seen how to create our own custom Unity UI editor. We replaced the default Inspector for our GameParameters-derived classes assets with a tailored-made one. For the sake of this tutorial, I decided to go in deep and work with C# reflection. This allowed us to get familiar with manipulating dynamic data types and made it…

--

--

Mina Pêcheux
.Net Programming

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