Answers for "unity 2d make enemy move towards player"

C#
9

make an enemy go towards player unity

float speed = whatever;
Vector2 positionToMoveTo = (whatever, whatever);

void Update()
{
  transform.position = Vector2.MoveTowards(transform.position, positionToMoveTo, speed * Time.deltaTime);
}
Posted by: Guest on December-17-2020

Code answers related to "unity 2d make enemy move towards player"

C# Answers by Framework

Browse Popular Code Answers by Language