ScriptableObjects
Setup in Unity
Create a new scene
Create a new GameObject called
Goap, add theGoapRunnerBehaviourto it.

Create a folder called
Configs.Within the
Configsfolder create a folder calledTargetKeys. Within this folder press right clickCreate > GOAP > Target Key Config. Call the configWanderTarget.Within the
Configsfolder create a folder calledWorldKeys. Within this folder press right clickCreate > GOAP > World Key Config. Call the configIsWandering.Within the
Configsfolder create a folder calledGoals. Within this folder press right clickCreate > GOAP > Goal Config. Call the configWanderGoal.Select the
WanderGoalscript in theclassproperty.Add a condition to the
conditionsproperty. Set thekeytoIsWandering, thecomparisontoGreaterThanOrEqualand thevalueto1.

Within the
Configsfolder create a folder calledActions. Within this folder press right clickCreate > GOAP > Action Config. Call the configWanderAction.Select the
WanderActionscript in theclassproperty.Set the
targettoWanderTarget.Add an effect to the
effectsproperty. Set thekeytoIsWandering, theincreasetotrue.

Within the
Configsfolder create a folder calledTargetSensors. Within this folder press right clickCreate > GOAP > Target Sensor Config. Call the configWanderTargetSensor.Select the
WanderTargetSensorscript in theclassproperty.Set the
keytoWanderTarget.

Within the
Configsfolder create a folder calledSets. Within this folder press right clickCreate > GOAP > Goap Set Config. Call the configGettingStartedSet.Add the
WanderGoalconfig to thegoalsproperty.Add the
WanderActionconfig to theactionsproperty.Add the
WanderTargetSensorconfig to thetargetSensorsproperty.

In the scene, add a GameObject called
GoapSet. Add theGoapSetBehaviourto it.In the
Configproperty of theGoapSetBehaviourselect theGettingStartedSetconfig.In the
Runnerproperty of theGoapSetBehaviourselect theGoapGameObject.

Create a sphere
GameObjectcalledAgent. Add theAgentBehaviour,AgentMoveBehaviourandAgentBrainto theGameObject.In the
GoapSetConfigproperty of theAgentBehaviourselect theGoapSetGameObject.

Run the scene. The agent should move around randomly.
Last updated