Skip to content

Update Manager

Facundo Balboa edited this page Apr 16, 2019 · 2 revisions

Tutorial in order to use the Update Manager. Using the Update Manager can boost your performance and also maintain you organized.


Basics

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.

Adding something to the Update Manager

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.

Removing something from the Update Manager

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.

Ask if something is in the Update Manager

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.

Clear all the calls to the Update Manager

You can clear all the ITicks for example by doing: UpdateManager.Instance.ClearTick();

This will make that all the objects stop from being called.

Warnings

  • 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.

Public Static Vars

  • UpdateManager Instance - Singleton of the Instance

Public Functions

  • 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