ScriptableObjects
Setup in Unity
Create a new scene
Create a new GameObject called
Goap
, add theGoapRunnerBehaviour
to it.
Create a folder called
Configs
.Within the
Configs
folder create a folder calledTargetKeys
. Within this folder press right clickCreate > GOAP > Target Key Config
. Call the configWanderTarget
.Within the
Configs
folder create a folder calledWorldKeys
. Within this folder press right clickCreate > GOAP > World Key Config
. Call the configIsWandering
.Within the
Configs
folder create a folder calledGoals
. Within this folder press right clickCreate > GOAP > Goal Config
. Call the configWanderGoal
.Select the
WanderGoal
script in theclass
property.Add a condition to the
conditions
property. Set thekey
toIsWandering
, thecomparison
toGreaterThanOrEqual
and thevalue
to1
.
Within the
Configs
folder create a folder calledActions
. Within this folder press right clickCreate > GOAP > Action Config
. Call the configWanderAction
.Select the
WanderAction
script in theclass
property.Set the
target
toWanderTarget
.Add an effect to the
effects
property. Set thekey
toIsWandering
, theincrease
totrue
.
Within the
Configs
folder create a folder calledTargetSensors
. Within this folder press right clickCreate > GOAP > Target Sensor Config
. Call the configWanderTargetSensor
.Select the
WanderTargetSensor
script in theclass
property.Set the
key
toWanderTarget
.
Within the
Configs
folder create a folder calledSets
. Within this folder press right clickCreate > GOAP > Goap Set Config
. Call the configGettingStartedSet
.Add the
WanderGoal
config to thegoals
property.Add the
WanderAction
config to theactions
property.Add the
WanderTargetSensor
config to thetargetSensors
property.
In the scene, add a GameObject called
GoapSet
. Add theGoapSetBehaviour
to it.In the
Config
property of theGoapSetBehaviour
select theGettingStartedSet
config.In the
Runner
property of theGoapSetBehaviour
select theGoap
GameObject.
Create a sphere
GameObject
calledAgent
. Add theAgentBehaviour
,AgentMoveBehaviour
andAgentBrain
to theGameObject
.In the
GoapSetConfig
property of theAgentBehaviour
select theGoapSet
GameObject.
Run the scene. The agent should move around randomly.
Last updated