# Resource node (Crystal Node)

## Step 1 (Asset)

To create **new resource node** we must first create an `EntitySO` data set with **capabilities**, before we create a prefab.

1. Select **Resource Node** type
2. Click **Create New** button
3. Set desired **name** and **description** of the resource node
4. **Cost** can be ignored here;&#x20;
5. Select **Capabilities** tab&#x20;
   1. With capabilities you add configuration for behaviours added to the entity/unit or modules managing them
6. Set node's **resource** and it's **quantity**

<figure><img src="https://3582497942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy2G6fDLEPuCAcuABMl6j%2Fuploads%2FFWNPAmOS7XYDyeB4PYmI%2Fcreate%20node.gif?alt=media&#x26;token=cc0a7f18-b630-48cc-a93a-5803149dad35" alt=""><figcaption><p>Create resource node steps 1/2</p></figcaption></figure>

## Step 2 (Prefab)

After data asset is created, we can proceed with creating a prefab:

1. Click on the **Create Prefab** button if you wish for prefab to be created automatically. If you use existing prefab, drag it in the **associated prefab** field and click **Update Prefab** instead. This step attaches (does not remove) any components required by defined capabilities themselves. Any other additional scripts we can add on the prefab directly.
2. Now click **Open Prefab** to and open **Scene** window to see it.
3. **Configure visuals** as desired, by default a primitive cube model is present.
4. **Add collider** to the **root game object**, primarily for selection and other potential raycasts your systems may be performing (such as navigation avoidance).
5. **Set Layer** of the root object (the one with collider) which is used for selection.

**Optional**

1. **Add Obstacle** for your navigation system, so units avoid the object.
2. **Add Static Interaction Position Provider**, a component which generates pre-defined positions for interacting with an object. This is useful only if you have no collision avoidance in your navigation and purely rely on direct destinations to interact.

<figure><img src="https://3582497942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy2G6fDLEPuCAcuABMl6j%2Fuploads%2FlXFBBJyRzQu7HZCVDbbf%2Fezgif-7a288e069a7674.gif?alt=media&#x26;token=0704f10e-53c4-4648-a25e-39823ddcad6f" alt=""><figcaption><p>Create resource node steps 2/2</p></figcaption></figure>

## Step 3 (Collector)

Either you have your own collector set up or you are using the provided worker included in the demo, make sure that the **resource collector capability** supports this resource. If supported resources array is **empty**, then all resources are supported; otherwise only listed ones can be collected.

<figure><img src="https://3582497942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy2G6fDLEPuCAcuABMl6j%2Fuploads%2FlDLskl6rDWUslhgBjTdr%2Fadd%20worker%20res.gif?alt=media&#x26;token=3c3402ec-5280-42ac-a306-3617f86ab33d" alt=""><figcaption><p>Add support to collector for new resource</p></figcaption></figure>
