How can I move the Camera to the right in Unity?

Updated on October 9, 2018 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on October 9, 2018

I am making a 2d platformer. It is an endless runner, but I want the player to be able to move around and to follow the camera, which keeps going at a constant speed towards the right. I guess I have to add my own script to the Camera to make it work that way but I don’t know what to write on it.

  • Liked by
2 on October 9, 2018

Probably that is what you want:

Brackey’s Youtube Video

on October 9, 2018

not really, I don’t need the player to be at the centre of the screen but I want the camera to move constantly to the right independently from the player, who should try to keep up with it. 

on October 9, 2018

If all you want is “camera move right” then a quick, and very VERY messy, way to do it is;

transform.position += Vector3.right * time.deltaTime * speed;

You may need to use transform.right instead of Vector3.right. I always forget which one is local.

Speed is the meters per-second you want to move.

Show more replies
  • Liked by