Couldn't target new units

So this took me a couple hours to work around. For some reason, the TryTarget would get the targeter from Unit, yet wouldn’t perform the CmdSetTarget. All of the code appeared to have lined up with the course. Anyways, I worked around this for now by splitting the command.

private void TryTarget(Targetable target)
{
    foreach (Unit unit in unitSelectionHandler.SelectedUnits)
    {
        Targeter targeter = null;
        targeter = unit.GetTargeter();
        targeter.CmdSetTarget(target.gameObject);
    }
}

Privacy & Terms