2D Mobile Game: Camera Follow Player
Intro
In this article, we will cover how to use Cinemachine to create a virtual camera that will follow the player.
Cinemachine
After installing Cinemachine from the package manager, we will create a virtual camera.
With the Virtual Camera created, we will rename CM Follow Cam, and move the camera back by setting the Z to -10. The virtual camera has the ability to follow a game object, which we will set to the Player.
Now we have the main camera following the Player.
This is happening because Cinemachine adds a Cinemachine Brain that allows the Main Camera to take the position and rotation of the virtual cameras.
There is much more you can do with Cinemachine and I look forward to diving deeper into this powerful tool.