> For the complete documentation index, see [llms.txt](https://goap.crashkonijn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://goap.crashkonijn.com/goap-v2/classes/worldkeys.md).

# WorldKeys

`WorldKeys` are important in the GOAP system. They point to specific things or situations in the game. The `Planner` uses these keys to decide what `Action` an agent should do next.

Each `WorldKey` is connected to a `WorldSensor`. This sensor checks and gives the current value for its `WorldKey`. So, the `WorldKey` tells us what to look for, and the `WorldSensor` tells us the current value of that thing in the game.

## Creating a WorldKey

### Using ScriptableObject:

1. In the Unity editor, right-click on the folder you want.
2. Go to `Create > Goap > WorldKey` to make a new `WorldKey`.

### Using Code:

You can also make a new `WorldKey` by writing a class that uses the `WorldKeyBase` class.

#### Example:

{% code title="IsHungry.cs" lineNumbers="true" %}

```csharp
using CrashKonijn.Goap.Behaviours;

public class IsHungry : WorldKeyBase
{
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://goap.crashkonijn.com/goap-v2/classes/worldkeys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
