xxxxxxxxxx
void FixedUpdate()
{
GameObject objects = GameObject.FindGameObjectsWithTag("Enemy");
var objectCount = objects.Length;
foreach (var obj in objects)
{
// Move the players accordingly
//var rb =
Vector2 direction = (player.position - transform.position).normalized;
obj.rigidbody.velocity = direction * moveSpeed;
}
}
xxxxxxxxxx
for(int i = 0; i < gameobject.transform.GetChildCount(); i++)
{
Transform Children = gameobject.transform.GetChild(i);
}
xxxxxxxxxx
for(int i = 0; i < gameobject.transform.GetChildCount(); i++)
{
Transform Children = gameobject.transform.GetChild(i);
}