System Locator
Class used to get game systems, using generics and then making cache of said systems.
Last updated
Was this helpful?
Class used to get game systems, using generics and then making cache of said systems.
Last updated
Was this helpful?
The SystemLocator is a class used to easily find any system that has been registered on it.
It helps us avoid falling into the , and does something similar to the . Also good for performance reasons, It can handle over a million calls every frame with no issues.
To register a new system you can call the SystemLocator.Register(this) method, it'll add that system into a dictionary of systems, preventing two of the same system from existing.
Then you can get this system from somewhere else using SystemLocator.Get<T>()
Note that is done automatically by classes inheriting System and NetworkedSystem. They register on Awake: