I understand the “how” in this part of this video but I don’t understand the “why”.
Unite 2013 - Internal Unity Tips and Tricks
At 5:55 in he talks about making a singleton:
Public void OnEnable()
{
if (Singleton == null)
Singleton = this;
}
Then at 6:30 in he uses the singleton to access a non-static function:
TowerManager.Singleton.AddTower();
What I don’t understand is why does he use this singleton? Why not just make the AddTower() function a static function and then call it as a Class function like this:
TowerManager.AddTower();