Setup ===== Neccessary Setup ----------- Here we star-off with an empty scene. First thing we need to do is save this scene and give it a name. This is neccessary because we can't create an ECS subscene otherwise. .. image:: /images/setup/1.png .. image:: /images/setup/2.png Right-click on the scene name and select *"New Empty SubScene"* .. image:: /images/setup/3.png Give it an appropriate name and save (don't try to change it's location). .. image:: /images/setup/4.png Now go to the *"Prefabs"* folder in this package, find the *Grid* prefab and place it as **a child of the SubScene**. .. note:: All GameObjects that are supposed to be baked to ECS objects must be placed in a subscene. .. image:: /images/setup/5.png Now place the *GridDebug* prefab **outside** of the subscene, so it is a regular GameObject. A grid should show up in the editor. .. image:: /images/setup/6.png Create two new LayerMasks, one for Inaccessible grid nodes and another for nodes with a Penalty. Here I intuitively called them **Inaccessiblee** and **Penalty**. .. image:: /images/setup/7.png Set these two LayerMasks in the GridAuthoring component in the Grid that you placed earlier in the subscene. .. image:: /images/setup/8.png Placing Obstacles ------------------ Create a new Cube and Make sure to place it in the **ECS-Subcene**. .. image:: /images/setup/9.png Scale the Cube and place it in one the quarters of the Grid. .. image:: /images/setup/10.png Set the Layer on the Cube to Inaccessible (we created this Lyaer Mask earlier). .. image:: /images/setup/11.png Add an ASObstacleAuthoring component to the Cube. And now it became an Obstacle that Agents will avoid. .. important:: Make sure that the Obstacle overlaps with the grid for best result. .. image:: /images/setup/12.png Now dupliacate this Cube 3 more times and place them in the other 3 quarters of the grid like this picture. .. image:: /images/setup/13.png First Agents ------------- Create a new *Plane*, placing it in the subscene is not too important as it is just a visual element but it would be a good practice to do so. Place the *Plane* at 0,0,0 and scale it by 3 in all directions. .. image:: /images/setup/14.png Go to the *Prefabs* folder again, grab the *Agent* prefab and place it near the corner of the grid. **And again, make sure it is inside the ECS-Subcene.** You will know it is when the Agent Capsule in Yellow is visible. .. image:: /images/setup/15.png In the ASAgentAuthoring component, check "Ignore Avoidace When Dest Reached" and "Has Init Destination". .. image:: /images/setup/16.png Now When we press play the Agent will move to the center of the Grid, that's because the initial destination is set to 0,0,0 .. image:: /images/setup/17.png Now dupliacate the agent multiple times and scatter them across the Grid. .. image:: /images/setup/18.png .. image:: /images/setup/19.png