I am currently tidying up my game logic and made a few mistakes in using global variables to handle logic. I want to come away from using global variables and have one FSM manage all of this. Ive been looking into using something like a singleton. Now all that I'm struggling with is the best approach to reference this singleton. Lets call it 'manager'. Its more complex as most of my objects are prefabs, so no way of using parenting as an alternative .
The only option that I have read about is (
https://www.youtube.com/watch?v=u4PV78MB2xE)...
1. Use a global variable to store a reference to the 'manager'.
but don't really want to use a global variable as this defeats the object. I don't want to use broadcast etc to the performance impact.
Is there another option for this?
Nick