HUD Framework

It's not necessary to understand the HUD framework to begin creating HUD elements for your vehicles. You can skip this section if you wish and come back later if you need clarification.

The two core components of the HUD framework are:

  • The HUD Manager

  • The HUD Component

HUD Manager

The HUD Manager goes on the root transform of the vehicle and manages the entire vehicle HUD. It can activate/deactivate all the HUD components on the vehicle.

HUD Component

The HUD Component represents a component of the vehicle's HUD. It can be used as a base class to create your own HUD components, or used directly on a game object to mark it as part of the HUD.

The main functions of this component are:

  • Enabling the HUD Manager to activate/deactivate that part of the HUD (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 or other scripts.

  • 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 the 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
    }
}

Camera View HUD Management

To help you easily manage how your HUD appears in different camera views, you can use the Camera View Parenter component.

To set this up:

  1. Add a Camera View Parenter component to the same game object as a HUD Component

  2. Add entries to the Camera View Parenting Items list. In each entry, you can specify a camera view and exactly what should happen to this part of the HUD in that camera view.

Last updated