Custom HUD Components

If you wish to add your own custom components to the HUD, you can create a script (and add it to your vehicle) that extends the HUD Component base class.

The main functions of this base class are:

  • Enabling the HUD Manager to activate/deactivate it (by enabling/disabling the game object on which it is attached).

  • Storing a reference to the HUD camera which can easily be accessed by the derived class.

  • Providing an overrideable update function for running code only when the HUD component is active.

When creating your own HUD scripts that derive from the HUD Component, you should override the On Update HUD function, so that your code is only called when the HUD component is active:

public class MyHUDComponent : HUDComponent
{
    protected override void OnUpdateHUD()
    {
        // My code to be called every frame this component is active
    }
}

Last updated