> 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/introduction/gettingstarted/scriptableobjects.md).

# ScriptableObjects

## Setup in Unity

1. Create a new scene
2. Create a new GameObject called `Goap`, add the `GoapRunnerBehaviour` to it.

![Goap Runner Behaviour](/files/lnVDISg7kofijME9S8px)

3. Create a folder called `Configs`.
4. Within the `Configs` folder create a folder called `TargetKeys`. Within this folder press right click `Create > GOAP > Target Key Config`. Call the config `WanderTarget`.
5. Within the `Configs` folder create a folder called `WorldKeys`. Within this folder press right click `Create > GOAP > World Key Config`. Call the config `IsWandering`.
6. Within the `Configs` folder create a folder called `Goals`. Within this folder press right click `Create > GOAP > Goal Config`. Call the config `WanderGoal`.
   1. Select the `WanderGoal` script in the `class` property.
   2. Add a condition to the `conditions` property. Set the `key` to `IsWandering`, the `comparison` to `GreaterThanOrEqual` and the `value` to `1`.

![Wander Goal](/files/LNbdcNzCuRFRglI6aUFQ)

7. Within the `Configs` folder create a folder called `Actions`. Within this folder press right click `Create > GOAP > Action Config`. Call the config `WanderAction`.
   1. Select the `WanderAction` script in the `class` property.
   2. Set the `target` to `WanderTarget`.
   3. Add an effect to the `effects` property. Set the `key` to `IsWandering`, the `increase` to `true`.

![Wander Action](/files/FasDcrRD2o2U2HZWsKiV)

8. Within the `Configs` folder create a folder called `TargetSensors`. Within this folder press right click `Create > GOAP > Target Sensor Config`. Call the config `WanderTargetSensor`.
   1. Select the `WanderTargetSensor` script in the `class` property.
   2. Set the `key` to `WanderTarget`.

![Wander Target Sensor](/files/89eY1DDsWV1Ep0Ceoys2)

9. Within the `Configs` folder create a folder called `Sets`. Within this folder press right click `Create > GOAP > Goap Set Config`. Call the config `GettingStartedSet`.
   1. Add the `WanderGoal` config to the `goals` property.
   2. Add the `WanderAction` config to the `actions` property.
   3. Add the `WanderTargetSensor` config to the `targetSensors` property.

![Getting Started Set](/files/xCrzgSz28B8WtuQaFZYb)

10. In the scene, add a GameObject called `GoapSet`. Add the `GoapSetBehaviour` to it.
    1. In the `Config` property of the `GoapSetBehaviour` select the `GettingStartedSet` config.
    2. In the `Runner` property of the `GoapSetBehaviour` select the `Goap` GameObject.

![Goap Set](/files/1Q0hz8kyld5fT0EfIZNe)

11. Create a sphere `GameObject` called `Agent`. Add the `AgentBehaviour`, `AgentMoveBehaviour` and `AgentBrain` to the `GameObject`.
    1. In the `GoapSetConfig` property of the `AgentBehaviour` select the `GoapSet` GameObject.

![Agent](/files/W8XLlIICwvkgZx9II8MY)

12. Run the scene. The agent should move around randomly.


---

# 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:

```
GET https://goap.crashkonijn.com/goap-v2/introduction/gettingstarted/scriptableobjects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
