Question by
shakeearth16 · Apr 13, 2020 at 04:03 AM ·
2dmovementunity 2d
transform.LookAt on 2d
So i'm trying to make a gameobject look towards the player and saw transform.LookAt and tried using it. It does work but the problem is it makes the gameobject rotate in a 3d way and my gameobject sprite is on 2d so it just vanishes during the scene.
//follows player
transform.position = Vector2.MoveTowards(transform.position, target.position, speedEnemy * Time.deltaTime);
//make enemy look towards player
transform.LookAt(target);
Comment
Your answer
Follow this Question
Related Questions
how to make my 2d top down character face the direction of the cursor 1 Answer
How can I get the player to face the direction it is going in a Unity 2D Game? 0 Answers
How do I create a 2D movement script that will cause prefabs to drift around the screen? 0 Answers
Unexpected symbol '=' parser error and Unexpected symbol '(' error 1 Answer