I am trying to get the component CheckPointEnemy
from each child object from an array of transforms, and then add those components to a list of CheckBehaviours. However I am only receiving the first component from the first child from the array of transforms:
public Transform() enemies;
public List<CheckPointEnemy> enemiesToTrigger;
foreach (Transform child in enemies)
{
enemiesToTrigger.Add(child.GetComponentInChildren<CheckPointEnemy>);
}
I imagine I should be using GetComponentsInChildren but I can not get the syntax correct.
Thank you for any help.