Globals protocol in Unity

Being a long-time business app developer I have a lot of experience on how to avoid globals in my projects. Being new to Unity, I’m not sure if I’m looking at posts from inexperienced developers or if Globals is actually an encouraged practice.

The situation I have is, when someone logs into my game I want to pull all account details for that player and keep them around to be used in any scene. Google searching has found me threads that suggest either PlayerPrefs, which in this case just doesn’t fit the bill, or global static variables.

I created a Globals class and added a static variable property for my account details just to see how it fits but want to make sure I’m not being led into bad Unity development practices.

Thanks

No, static or singletons are not bad practice. Just use them when it’s required.

1 Like

Cheers