Repository navigation
Update Manager
Tutorial in order to use the Update Manager. Using the Update Manager can boost your performance and also maintain you organized.
In order to use the Update Manager, you can just call the singleton it has by doing:
UpdateManager.Instance. //whatever you want to do
With it, you will be able to use it from every place you need.
If you want to make an object to be updated every frame, you will need to implement the interface ITick for example. Once you have this, you can call in that class:
UpdateManager.Instance.AddTick(this);
Once you do this, the function that brings the ITick interface will be called every frame.
If you want to remove an object from the update. You can call:
UpdateManager.Instance.RemoveTick(this);
Once you do this, the function that brings the ITick interface will stop being called every frame.
You can know if something is being called in the Update Manager by calling:
UpdateManager.Instance.ContainsTick(this);
This will return a bool letting you know if the object is being called.
You can clear all the ITicks for example by doing: UpdateManager.Instance.ClearTick();
This will make that all the objects stop from being called.
- Remember to remove objects from the Update Manager if you are going to destroy it
- Note that the Update Manager doesn't destroy when changing a scene, so it will try to keep calling the objects.
- UpdateManager Instance - Singleton of the Instance
- void AddTick(ITick t) - Adds a Tick
- void AddLateTick(ILateTick t) - Adds a Late Tick
- void AddFixedTick(IFixedTick t) - Adds a Fixed Tick
- void RemoveTick(ITick t) - Removes all existance of a Tick
- void RemoveLateTick(ILateTick t) - Removes all existance of a Late Tick
- void RemoveFixedTick(IFixedTick t) - Removes all existance of a Fixed Tick
- bool ContainsTick(ITick t) - Tells if it contains a Tick
- bool ContainsLateTick(ILateTick t) - Tells if it contains a Late Tick
- bool ContainsFixedTick(IFixedTick t) - Tells if it contains a Fixed Tick
- void ClearTick() - Clears Tick calls
- void ClearLateTick() - Clears Late Tick calls
- void ClearFixedTick() - Clears Fixed Tick calls