Search Unity

RTS Gather

Discussion in 'Prefabs' started by SunPartil, May 9, 2021.

  1. SunPartil

    SunPartil

    Joined:
    Oct 22, 2019
    Posts:
    1
    Hello I’m ATM building an RTS inspired by the game called “Dawn of Man”. In that game you can drag out a flag of a certain type like stick gather and it will get all the stick within that area. I would like to have a similar mechanic. Basically find all “sticks” within a area so then an NavMeshAgent can go an gather it. I’m not looking for help with the gather just how to find all the sticks in that area and place em in to maybe array. I know how to make an array but I can’t seem to make this efficient.

    first I used a Gizmos Sphere to detect every collider in radius and then putting them in array. After I go through this array and put all the GameObject of certain tag to their own array. Tho once a stick is removed it won’t get removed from that list. Basically I can’t seem to find a workaround how to do this mechanic.
     
  2. pietrodenicola

    pietrodenicola

    Unity Technologies

    Joined:
    Dec 8, 2020
    Posts:
    43
    Hi. The scenario you described is complex and it's difficult to give an answer. I would suggest that you provide some small script code where you point out how you are removing the stick and what you expect to happen. We can start from that.