Magic Time Manager
v1.0
Last updated
v1.0
Last updated
Create an empty object, perhaps named "Magic Time Manager", and add the MagicTimeManager
component onto it. This holds LocalTimeScale
instances which can be accessed by any IUseMagicTime
(or MagicTimeUser
) object.
Populate this list with Local Time Scale Scriptable Objects you've created. Each will be replaced with a new instance of those objects, to keep from overwriting the default values on the Scriptable Objects.
At runtime, information about each LocalTimeScale
will be shown here, including the current value and the number of subscribers.
Other objects which inherit from MagicTimeUser
or implement IUseMagicTime
can "Subscribe to Initial TimeScales". When this happens, they subscribe to the instance assigned to the Magic Time Manager.
This way, all objects will be following the same instance, and share the same information.
This List<LocalTimeScale>
is populated automatically when you view the Magic Time Manager in the Inspector. It contains all of the Scriptable Objects in the project, so you can easily find them.
This is also used when the TimeScale()
method is called -- if the LocalTimeScale
has not been instanced yet, then the script will look it up in this list, before trying to create a new LocalTimeScale
object.
Don't forget to check out the Magic Time Manager Scripting page for more information on what you can do with this class.