I have an enemy object, and it needs to move around an arena. I also have four Wall gameObjects surrounding this arena, and both the enemy and walls have colliders (not set to isTrigger). This is how I currently move the enemy (this is called in the Update loop):
float step = moveSpeed * Time.deltaTime; transform.position = Vector2.MoveTowards(transform.position, target.transform.position, step);
Works great, except for when it chases a target outside of the arena entirely, ignoring the walls. I'm guessing it's because I'm explicitly setting the position? Is there another way to move it that will obey the colliders?