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
PointOfInterestScriptableObject asset, which provides the location ID, world position, display name, and arrival radius automaticallyManual — 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
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
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)
QuestObjective)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:
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
OnTriggerEntercallingReportLocationReachedThe POI discovery system when the player enters a
PointOfInterest'sLocationRadiusA
QuestTriggerusing theOnTriggerEnteractivation method (thoughReportLocationReachedis 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
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)
Create or select a
PointOfInterestScriptableObject withCategoryset toLocationAssign it to Target Location on the objective
The POI's
LocationRadiusdefines the arrival area — when the player enters it, the POI system firesReportLocationReachedautomatically
The objective's LocationId, TargetPosition, RequiredDistance, and LocationName are all derived from the POI asset, so there is nothing else to configure.
Manual
Set Use Manual Values to
trueEnter a Manual Location ID — this must exactly match whatever string your scene trigger passes to
ReportLocationReachedSet Manual Target Position to the destination's world coordinates for compass and minimap guidance
Set Manual Required Distance as a reference value for your trigger volume
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
LocationIdmatching inCheckCompletionis the same flag key (reached_{LocationId}) written byQuestManagerwhen processing the event. If you change theTarget Locationasset orManual Location IDafter a quest has already started, the flag key will not match previously written progress data.RequiredDistance/LocationRadiusis stored inQuestProgressviaprogress.SetLocation(LocationId, TargetPosition)duringInitialize(), 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,
QuestManagerreadsTargetPositionfrom this objective directly viaGetObjectiveWorldPosition()— this is the only objective type that provides a world position natively. All other objective types rely on a linkedPointOfInterestmarker for positional data.If two active quests both have a
GoToLocationObjectivewith the sameLocationId, a singleLocationReachedevent completes both simultaneously.
Last updated