Add the Resource component to the main resource object and configure it from the inspector.
Resource General Settings:
- Name: Input the resource type in this field, this is the same name that is defined in the Resource Manager component.
- Code: Unique for each resource variation (for example, two resources can have different models and look but they allow the unit to collect the same resource type, therefore they must have the same Name but different codes).
- Radius: The radius of the resource on the navigation mesh.
- Amount: The amount that this resource hold.
- Infinite: When enabled, the resource’s amount will be infinite.
- Destroy On Complete: In case the resource amount is not infinite and this is set to true, then the resource object will be destroyed when its amount is null.
Collection & Drop Off Settings:
- Collect Outside Border: When enabled, then units will be able to collect this resource even if it’s outside their faction resources.
- Collect Amount Per Second: The amount that a unit collects from this resource each second.
- Have Drop Off Range: When enabled, then this will require the collector to drop this resource only to drop off buildings that are inside a certain range. You should only consider this option if the resource collection mode is not set to automatic.
- Drop Off Range: the range size for the above option.
- Show Collectors: When enabled, the amount of collectors will be shown in the selection panel when the resource is selected.
- Show Amount: When enabled, the amount of the resource will be shown in the selection panel when the resource is selected.
- Resource Plane: This is the object that holds the selection texture and which will be activated when the resource is selected. Also a child object of the main resource’s object and has “Resource” as its layer.
- Player Selection: The selection collider must not be the same as the resource’s main collider. Therefore, create a new empty object and make it child of the main resource’s object. Then add a Collider to this object (with “Is Trigger” set to true). This collider represents where the player has to click with the mouse in order to select the resource. Finally, add the SelectionObj component to the selection object and drag and drop this object to the “Player Selection” field in the Resource component, the SelectionObj component has the following fields:
- Obj Type: Set to Resource.
- Can Select: Can this resource be selected?
- Select Owner Only: Only applicable for units & buildings.
- Minimap Icon Size: Represents the size of the minimap icon for this resource.