In this tutorial we’ll add HUDs to mark quest givers and quest objectives.
This tutorial is part 5 of a mini-series covering quests. You can find the start of this series here.
We’ll set up 2 HUDs, one for marking objects that start new quests and one for marking objects that are part of active quests.
This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials and uses the previous quest tutorials, but can be used in any project.
HUD Prefabs #
First, we’ll set up 2 HUD prefabs – we’ll keep it simple and just display an icon (sprite).
New Quest HUD #
Create an empty HUD without any layout, either using the scene hierarchy context menu (ORK Framework > HUD > HUD) or the ORK toolbar (search for: HUD).
Rect Transform #
The HUD will be placed at the position of an object in the scene, so we only adjust the width and height.
- Width
Set to: 50 - Height
Set to: 50
Image #
Add an Image component to the HUD object using the component menu.
- Source Image
Select: icons_14
Create Prefab #
That’s already all we need to do.
Create a prefab out of the HUD object (without the canvas), e.g. name it Quest New HUD.
Progress Quest HUD #
We’ll adjust the still added HUD object for our 2nd HUD.
Image #
We simply use a different icon.
- Source Image
Select: icons_15
Create Prefab #
That’s already all we need to do.
Create a new prefab out of the HUD object (without the canvas), e.g. name it Quest Progress HUD.
HUD Setup #
Open the ORK editor and navigate to UI > HUDs, we’ll add 2 new HUDs.
Quest New #
We’ll use Object HUDs, they are displayed at object instances in the scene and also have to be added to them using an Object HUD component.
Base Settings #
- Name
Set to: Quest New - HUD Type
Select: Object - Auto Display
Enable
Object Settings #
- Child Object
Select: Path - Find Child
Set to: HUD
We’ll also need to add this child object for placing the HUD to our objects (we’ll add it to the NPC prefabs). - Use Range Limit
Enable
We’ll only show the HUD if the player is within a defined range of the object. - Range
Select: Value > Value
Set the value to: 40 - Threshold
Select: Value > Value
Set the value to: 1
Display Conditions > Game State Condition #
We’ll only display the HUD when the player is in control using a game state condition.
Click on Add Game State.
- Game State
Select: In Contro - Check State
Select: Active
Unity UI #
- UI Layout
Select: HUD - HUD Prefab
Select: Quest New HUD
Quest Progress #
Copy the Quest New HUD.
Base Settings #
- Name
Set to: Quest Progress
Unity UI #
- HUD Prefab
Select: Quest Progress HUD
Save Settings #
That’s it for the HUD setup – we’ll now add the HUD to objects in the scene.
Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Updating NPC Prefabs #
Before adding the HUD, we’ll add the HUD child object for placing the HUD to our quest-related NPC prefabs.
You can find the NPC prefabs in Assets/Tutorial Assets/Prefabs/NPCs/. I’m updating the Worker_Female and Knight_Male prefabs, but feel free to add it to all NPCs.
Open the prefab for editing.
Add a new empty object to the Worker_Female root object and name it HUD.
Transform #
Change the position of the added HUD object.
- Position
Set to: X=0, Y=4, Z=0
Guard NPC #
The town’s guard gives us hunting quests.
We’ll display only the Quest New HUD, since the guard only gives new quests but isn’t part of any active quest. The HUD will be displayed if any hunting quest is available (i.e. not added and
Add an Object HUD component to the Knight_Male object (near the town entrance) using the component menu.
Object HUD 0 #
- Object HUD
Select: Quest New
Click on Add Condition.
- Condition Type
Select: Quest Type
Click on Add Quest Type Condition.
- Content Type
Select: Hunting Quests - Check Status
Select: Available
Crafting NPC #
The crafting NPC gives us 2 quests, Collect Potion Materials and Collect Equipment Materials.
Add an Object HUD component to the Worker_Female object (at the wood workshop) using the component menu.
Object HUD 0 #
We’ll display the Quest Progress HUD if either the quest task Deliver Potion Materials or Deliver Equipment Materials is active.
- Object HUD
Select: Quest Progress
Click on Add Condition.
- Condition Type
Select: Quest Task - Needed
Select: One
Only one of the conditions must be valid.
Click on Add Task Condition.
- Content Type
Select: Deliver Potion Materials - Check Status
Select: Active
Click on Add Task Condition.
- Content Type
Select: Deliver Equipment Materials - Check Status
Select: Active
Object HUD 1 #
We’ll display the Quest New HUD if either the Collect Potion Materials quest is available or the quest was finished and the Collect Equipment Materials quest is available.
Click on Add Object HUD.
- Object HUD
Select: Quest New - Needed
Select: One
Click on Add Condition.
- Condition Type
Select: Quest
Click on Add Quest Condition.
- Quest
Select: Collect Potion Materials - Check Status
Select: Available
Copy Condition 0.
Change Quest Status Condition 0.
- Check Status
Select: Finished
Click on Add Quest Condition.
- Quest
Select: Collect Equipment Materials - Check Status
Select: Available
And that’s it for our setup – don’t forget to save your scene.
Testing #
Hit play and run to your quest NPCs.
The guard NPC will show an icon when he has quests available.
The crafting NPC will start with showing a Quest New HUD and use the Quest Progress HUD when one of the deliver tasks is active.
The quest tutorial mini-series will continue!




