Purpose: A class that stores the runtime state (progress) of a quest during gameplay. A QuestState is generated by the QuestManager when the player accepts a quest, kept in memory, and serialized to JSON for save files.
QuestState is not configured directly in the Inspector (except for debugging if you inspect the array inside QuestManager). It is purely a runtime object.
It stores:
- The quest identifier (
_questId). - The current status (
_status: NotStarted, Active, Completed, Failed). - A list of current progress values for each objective (e.g., how many boars killed).
- A list of completion flags for each objective (
true/false).
Usually, you do not modify QuestState manually. You interact with it via QuestManager.
However, if you want to display progress in the UI, you can retrieve it:
// Get the state of an active quest
QuestState state = QuestManager.I.GetState("kill_boars");
if (state != null) {
// Check how many items we've collected for the first objective (index 0)
int currentAmount = state.GetObjectiveProgress(0);
// Check if the objective is completed
bool isDone = state.IsObjectiveCompleted(0);
}