In this tutorial we’ll set up HUDs used as templates.
This tutorial is part 2 of a mini-series covering menu screens. You can find the start of this series here.
HUDs can be used as templates to be added to UI boxes (either directly or on buttons) – we’ll make use of this to display status information of our combatants in different ways.
We’ll set up 3 HUD templates:
- template with portrait, name, level, status values (HP and MP), status effects
- another variant of this, but including experience bar
- listing all Normal type status values (for equipment change previews)
We’ll also set up 2 button prefabs:
- an empty button prefab we’ll use in our menus to display a HUD template
- a choice title button for the equipment menu, showing the slot beside the button (which shows the equipment).
This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials, but can be used in any project.
As with all content when using Unity UI, we’ll set up prefabs. It’s best to do this in the UI Environment Scene, so open it.
Status Value UI and Status Effect UI #
Before setting up our templates, we need status value UI and status effect UI set up in our project.
If you haven’t done so yet, please follow the status value UI setup and status effect UI setup tutorials.
Combatant Info HUD Prefab #
We’ll start the HUD setup with a template that’ll be used as information in some menu screens, as well as the content for buttons in combatant selections (e.g. also for target selection in battle menus).
The HUD will display the combatant’s portrait, name, level, HP, MP and status effects.
Create a new HUD either using the scene hierarchy context menu (ORK Framework > HUD > HUD (Horizontal Layout)) or ORK toolbar (search for: HUD Horizontal).
HUD #
We’ll adjust the root HUD object.
Rect Transform #
- Width
Set to: 300
This is just for making editing a bit easier and things better visible.
The actual width of the HUD will be set whatever is displaying it, e.g. a UI box or input button.
UI Color Changer #
Remove the UI Color Changer component.
Usually, we’ll want this added to be able to change the color of the HUD, but this HUD is used as a template and displayed by UI boxes or inputs on them.
When used on inputs, the UI Color Changer of the HUD would interfere with the input’s color changer, preventing from using the input’s color for selection highlighting.
Content Size Fitter #
Add a Content Size Fitter component and change the following setting.
- Vertical Fit
Select: Preferred Size
Portrait #
Add a portrait either using the context menu on the HUD object (ORK Framework > HUD > Content > HUD: Portrait Content (Sprite)) or ORK toolbar (search for: HUD Portrait Sprite)
HUD Portrait Content #
The HUD Portrait Content component is used to define the portrait that will be displayed (via organizer type).
- Organizer Type
Select: Portrait
Layout Element #
Add a Layout Element component to the portrait’s object and change the following settings.
We’ll use a size of 128×128.
- Preferred Width
Enable
Set the value to: 128 - Preferred Height
Enable
Set the value to: 128
Child Object #
Add an empty child object to the HUD object and rename it to e.g. Status Information. We’ll use this to list the combatant’s status information vertically beside the portrait.
Add a Vertical Layout Group component to the child object and change the following settings.
- Spacing
Set to: 5 - Control Child Size
Enable Width and Height. - Child Force Expand
Enable Width.
Disable Height.
Status Text #
We’ll add the name and level of the combatant.
With the Status Information child object selected, use the context menu (ORK Framework > HUD > Content > HUD: Text Content) or ORK toolbar (search for: HUD Text).
HUD Text Content #
- Content Type
Select: Combatant Information - Default Content (Text)
Set to: <name>, Level <level>
TextMesh Pro – Text (UI) #
Adjust the text to your liking, e.g. I’m using:
- Font Size
Set to: 20 - Vertex Color
Select a yellow color with full alpha value.
Status Value List #
We’ll add the status values HP and MP using status value UI with a value bar.
With the Status Information child object selected, use the context menu (ORK Framework > HUD > Status Value > Status Value List (Vertical Layout)) or ORK toolbar (search for: Status Value List Vertical).
HUD List Content #
- List Type
Select: Status Value - List Status Values
Select: Defined
Change the already added Status Value 0 settings.
- Status Value
Select: HP
Click on Add Status Value.
- Status Value
Select: MP
The status value UI was set up in this tutorial, so we’ll use either the bar or bar_preview UI key.
- UI Key
Set to: bar or bar_preview
Status Effect List #
We’ll add the status effects of the combatant.
With the Status Information child object selected, use the context menu (ORK Framework > HUD > Status Effect > Status Effect List (Grid Layout)) or ORK toolbar (search for: Status Effect List Grid).
HUD List Content #
- List Type
Select: Status Effect - Count Limit
Select: All
This shows all status effects of the combatant. - Effect Origin
Select: Current or Preview
Which one you use should depend on which UI key you used for the status values.
E.g. if your status values show previews, you most likely also want to have status effects show previews. - UI Key
Leave empty.
Grid Layout Group #
- Cell Size
Set to: X=50, Y=50 - Spacing
Set to: X=5, Y=5
Create Prefab #
The finished HUD will look like this:
That’s it for this HUD prefab – create a prefab out of it and name it Combatant Information HUD.
Combatant Info EXP HUD Prefab #
With the HUD still open, we’ll now make a small adjustment and create another prefab.
Status Value List #
Select the HUD > Status Information > Status Value List child object and change the following settings in the HUD List Content component.
Click on Add Status Value.
- Status Value
Select: Experience
Create Prefab #
That’s it for this HUD prefab – create a new prefab (original or variant) out of it and name it Combatant Information EXP HUD.
Status Value Preview HUD #
Now, we’ll create a new HUD that’ll list all Normal type status values to show preview values (e.g. in the equipment menu).
Create a new HUD either using the scene hierarchy context menu (ORK Framework > HUD > HUD (Vertical Layout)) or ORK toolbar (search for: HUD Vertical).
HUD #
We’ll adjust the root HUD object.
Rect Transform #
- Width
Set to: 300
Like the combatant info HUD, this is just for the setup.
The HUD will adjust to where it’s used as a template.
UI Color Changer #
Remove the UI Color Changer component.
Vertical Layout Group #
- Spacing
Set to: 20
Content Size Fitter #
Add a Content Size Fitter component and change the following setting.
- Vertical Fit
Select; Preferred Size
Status Text #
We’ll add the name and level of the combatant.
With the Status Information child object selected, use the context menu (ORK Framework > HUD > Content > HUD: Text Content) or ORK toolbar (search for: HUD Text).
HUD Text Content #
- Content Type
Select: Combatant Information - Default Content (Text)
Set to: <name>, Level <level>
TextMesh Pro – Text (UI) #
Adjust the text to your liking, e.g. I’m using:
- Font Size
Set to: 20 - Vertex Color
Select a yellow color with full alpha value.
Status Value List #
With the HUD object selected, use the context menu (ORK Framework > HUD > Status Value > Status Value List (Vertical Layout)) or ORK toolbar (search for: Status Value List Vertical).
HUD List Content #
- List Type
Select: Status Value - List Status Values
Select: Status Value Type - Status Value Type
Select: Normal - UI Key
Set to: preview
Vertical Layout Group #
- Spacing
Set to 10.
Create Prefab #
The finished HUD will look like this:
That’s it for this HUD prefab – create a new prefab out of it and name it Status Value Preview HUD.
Empty Button Prefab #
We’ll set up the empty button – but we’ll not use the Empty Button variant from the context menu, as we still want the button to have an image, just no content.
Use the scene hierarchy context menu (ORK Framework > UI Box > Input (Button) > UI Box: Choice Button) or ORK toolbar (search for: Choice Button).
Remove Child Objects #
Remove the Image and Text Child objects from the button.
Image (Optional) #
Select the Choice Button object and change the Image component.
- Source Image
Select: Button Simple
Layout Element #
- Min Height
Set to: 50
Create Prefab #
The button should look like this:
That’s it for this button prefab – create a prefab out of it and name it Empty Button.
Title Button Prefab #
As our last prefab, we’ll set up the title button, using a fixed width for the title to have all buttons align neatly.
Use the scene hierarchy context menu (ORK Framework > UI Box > Input (Button) > UI Box: Choice Title Button fixed Width) or ORK toolbar (search for: Choice Title Button fixed).
We can simply use the default setup without any changes. The title will have a fixed width of 200.
Create Prefab #
The button should look like this:
That’s it for this button prefab – create a prefab out of it and name it Choice Title Button.
HUD Setup #
Open the ORK editor and navigate to UI > HUDs, we’ll add 3 new HUDs.
All 3 HUDs will be used as templates, i.e. they’re not displayed on their own, so we can ignore most of their settings.
Combatant Information #
- Name
Set to: Template: Combatant Information - HUD Type
Select: Combatant - Auto Display
Disable
Unity UI #
- UI Layer
Select: HUDs - HUD Prefab
Select: Combatant Information HUD
Combatant Information EXP #
Copy the Template: Combatant Information HUD and change the following settings.
- Name
Set to: Template: Combatant Information EXP
Unity UI #
- HUD Prefab
Select: Combatant Information EXP HUD
Status Value Preview #
Copy the Template: Combatant Information EXP HUD and change the following settings.
- Name
Set to: Template: Status Value Preview
Unity UI #
- HUD Prefab
Select the Status Value Preview HUD prefab.
Save Changes #
And that’s it!
Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
The next part of the menus mini-series will set up the general menu related settings.





