Go To Location Objective

Overview

GoToLocationObjective tracks whether the player has reached a specific location in the world. It listens for a QuestEventType.LocationReached event carrying a matching location ID, then sets a completion flag in quest progress.

It supports two configuration modes:

  • POI-based (recommended) — links directly to a PointOfInterest ScriptableObject asset, which provides the location ID, world position, display name, and arrival radius automatically

  • Manual — all values are set by hand directly on the objective

GoToLocationObjective is added as an objective entry on a Quest ScriptableObject. It is not a component. The event that satisfies it is fired by whatever system detects the player's arrival — typically a trigger collider calling QuestEventReporter.Instance.ReportLocationReached(locationId), or the POI discovery system when the player enters a POI's radius.


Fields

Target Location

Field
Type
Description

Target Location

PointOfInterest

A PointOfInterest ScriptableObject asset to derive all location data from. When assigned and Use Manual Values is false, the Location ID, world position, display name, and arrival radius are all sourced from this asset automatically.

Manual / Override Settings

Field
Type
Description

Use Manual Values

bool

When true, ignores the assigned Target Location asset and uses the manual fields below instead. Enable for legacy support or when a POI asset is not available.

Manual Location ID

string

The location identifier to match against incoming LocationReached events. Only used when Use Manual Values is true or no Target Location is assigned.

Manual Target Position

Vector3

The world-space position of the destination. Used by QuestManager's distance tracking system to display compass and minimap guidance. Only used when Use Manual Values is true or no Target Location is assigned.

Manual Required Distance

float

The arrival radius in metres. This value is stored in QuestProgress for reference but the objective itself does not perform the proximity check — the event source (trigger collider, POI system) is responsible for determining when the player is close enough and firing the event.


Inherited Fields (from QuestObjective)

Field
Type
Description

Objective ID

string

Auto-generated GUID uniquely identifying this objective within its quest.

Description

string

Text shown to the player in the Quest Journal and HUD tracker.

Is Optional

bool

When true, this objective does not need to be completed for the quest to complete.


Derived Properties

These are computed at runtime from the active configuration mode and are read-only:

Property
Description

LocationId

The location ID used for event matching. Sourced from PointOfInterest.LocationId or manualLocationId.

TargetPosition

The world-space destination position. Sourced from PointOfInterest.WorldPosition or manualTargetPosition. Used by the objective distance tracking system in QuestManager.

RequiredDistance

The arrival radius. Sourced from PointOfInterest.LocationRadius or manualRequiredDistance.

LocationName

The display name of the location. Sourced from PointOfInterest.POIName or manualLocationId as fallback. Used in progress text.

HasTargetLocation

true if a PointOfInterest asset is assigned and Use Manual Values is false.


How It Works

Matching

When a LocationReachedEventData event arrives, QuestManager checks whether eventData.locationId matches LocationId on each active GoToLocationObjective. When a match is found, QuestProgress.SetFlag($"reached_{LocationId}", true) is called.

Completion Check

The flag is set to false on quest start via Initialize() and flipped to true the first time a matching LocationReached event fires. There is no count — it is a binary reached / not reached state.

Who Fires the Event

GoToLocationObjective is purely reactive — it does not poll the player's position. Something in the scene must call:

Common sources:

  • A trigger collider OnTriggerEnter calling ReportLocationReached

  • The POI discovery system when the player enters a PointOfInterest's LocationRadius

  • A QuestTrigger using the OnTriggerEnter activation method (though ReportLocationReached is the cleaner path)

Event Subscription Lifecycle

When the parent quest starts, QuestManager calls SubscribeToEvents(eventBus), subscribing this objective to QuestEventType.LocationReached. When the quest ends, UnsubscribeFromEvents(eventBus) removes the subscription.


Progress Text Format

State
Example Output

Not reached

Go to Abandoned Mine: ✗

Reached

Go to Abandoned Mine: ✓

The LocationName property is used in the progress text — for POI-based objectives this is the POIName from the asset; for manual objectives it falls back to the manualLocationId string.


Connecting to the Scene

POI-Based (Recommended)

  1. Create or select a PointOfInterest ScriptableObject with Category set to Location

  2. Assign it to Target Location on the objective

  3. The POI's LocationRadius defines the arrival area — when the player enters it, the POI system fires ReportLocationReached automatically

The objective's LocationId, TargetPosition, RequiredDistance, and LocationName are all derived from the POI asset, so there is nothing else to configure.

Manual

  1. Set Use Manual Values to true

  2. Enter a Manual Location ID — this must exactly match whatever string your scene trigger passes to ReportLocationReached

  3. Set Manual Target Position to the destination's world coordinates for compass and minimap guidance

  4. Set Manual Required Distance as a reference value for your trigger volume

Quest ScriptableObject
Scene

manualLocationId = "ForestCave"

Trigger calls ReportLocationReached("ForestCave")

manualTargetPosition = (120, 0, 45)

Trigger volume centred near that position


Example Configurations

"Travel to the Abandoned Mine" — POI-based

"Reach the summit" — manual


Other Notes

  • The LocationId matching in CheckCompletion is the same flag key (reached_{LocationId}) written by QuestManager when processing the event. If you change the Target Location asset or Manual Location ID after a quest has already started, the flag key will not match previously written progress data.

  • RequiredDistance / LocationRadius is stored in QuestProgress via progress.SetLocation(LocationId, TargetPosition) during Initialize(), but the objective does not use it to gate completion. It exists so distance-tracking UI systems can read it if needed.

  • For compass and minimap distance display, QuestManager reads TargetPosition from this objective directly via GetObjectiveWorldPosition() — this is the only objective type that provides a world position natively. All other objective types rely on a linked PointOfInterest marker for positional data.

  • If two active quests both have a GoToLocationObjective with the same LocationId, a single LocationReached event completes both simultaneously.

Last updated