i have turrets that use a radius, each time a gameobject enters the radius the turret will turn towards it.unfortunately, when there are multiple target the turret gets confused as to who he should target. how do i make the turret aim at the first, and then when its dead ( or leaves) it focuses on the next available target
bool turret_has_target = false; //global var
//following should be in Update func
if (!turret_has_target)
{
//your script for targeting
if (/*aim succesfull*/) turret_has_target = true;
}
else
{
//your aim code
//in this part check target presence
if (/*target destoyed or smth else*/) turret_has_target = false;
}