Since my initial commit on January 4th, 2021, I've been toiling away every week on a game. Being a pseudo-randomized simulation exemplary of the management genre, there are many interacting systems. I am not strictly speaking of systems in an abstract sense, but in terms of Unity's concrete ECS implementation. To save development time, regrettably I am forced to hybridize these systems with GameObjects, because there is not yet an official alternative. Be aware that, without pooling and other techniques, GameObjects rapidly created and destroyed at runtime is often an affront to garbage collection.
I believe that CPU performance optimization of management and RTS games is more critical than that of any other type of game. The vast majority of 2D side-scrollers can (and do) get away with awful code since, usually, there's not much happening at runtime. Simple games require little programming and algorithmic knowledge. However, Terraria is an instructive counterexample that many developers would struggle and flounder to reproduce. Thankfully there is one package making it easier to develop runtime-heavy games like it in Unity.
That package is called Graphy.
Graphy can visualize statistics at runtime for built games and those being run in the editor. It's available on GitHub under the MIT license. (You can also find it on the Asset Store, if that's your thing.) While there are other contributors, the software is mainly developed by Martin Pane. According to the GitHub README, Graphy features the following:
- FPS, memory and audio graphs
- Advanced device information
- Debugging tools
- Customizable look and feel
- Multiple layouts
- Easy-to-use API
- Works on multiple platforms
- Background mode
- Works from Unity 5.4 and up
- Well-documented C# and Shader code included
One of the first things this package helped me determine was that there was a memory leak stemming from the use of Mono. I noticed this behavior in the editor, but not in my builds because they leverage IL2CPP. Without Graphy, investigating this issue would have been much less convenient. I strongly recommend integrating Graphy in your project. It may save you some time!