1. Home
  2. Unity RTS Engine
  3. Resources
  4. Resource Main Component

Resource Main Component

Add the Resource component to the main resource object and configure it from the inspector.

Resource General Settings:

  1. Name: Input the resource type in this field, this is the same name that is defined in the Resource Manager component.
  2. 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).
  3. Radius: The radius of the resource on the navigation mesh.
  4. Amount: The amount that this resource hold.
  5. Infinite: When enabled, the resource’s amount will be infinite.
  6. 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:

  1. Collect Outside Border: When enabled, then units will be able to collect this resource even if it’s outside their faction resources.
  2. Collect Amount Per Second: The amount that a unit collects from this resource each second.
  3. 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.
  4. Drop Off Range: the range size for the above option.

UI Settings:

  1. Show Collectors: When enabled, the amount of collectors will be shown in the selection panel when the resource is selected.
  2. Show Amount: When enabled, the amount of the resource will be shown in the selection panel when the resource is selected.

Resource Components:

  1. 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.
  2. 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:
    1. Obj Type: Set to Resource.
    2. Can Select: Can this resource be selected?
    3. Select Owner Only: Only applicable for units & buildings.
    4. Minimap Icon Size: Represents the size of the minimap icon for this resource.


How can we help?