First thing to add is a Collider component to the main unit object with “Is Trigger” set to true. This collider defines the unit’s boundaries in relation to some obstacles.
Add a Rigidbody component to the main unit object and Set “Is Kinematic” to true and “Use Gravity” to false.
Add an Audio Source component to the main unit object and make sure that:
- “Spatial Band” is set to 3D (equal to 1).
- Under “3D Sound Settings”, set “Doppler Level” and “Spread” both to 0. “Volume Rolloff” should be set to “Linear Rolloff”. And set the “Min Distance” and “Max Distance” to show how loud you want sound coming from the unit to be heard from distance.
Navigation Mesh Agent:
Add a Nav Mesh Agent component to the main unit object and pick the unit’s radius. This defines the space that the unit occupies on the navmesh.
If you want to animate your units while they are attacking, collecting resources, building, etc.. Then you need an Animator component attached to the main unit object (or the unit model but in this case you need to assign the animator in the main Unit component which will be covered in the next page). Please use the animator controller that came with the demo as a reference for all the animator you create for each unit. This controller is composed of 8 states: Idle, Moving, Collecting, Building, Attacking, Take Damage, Healing, Converting and Dead and 9 Boolean parameters (one for each state): IsIdle, IsMoving, IsCollecting, IsBuilding, IsAttacking, TookDamage, IsHealing, IsConverting and IsDead.