Unity Development — Camera Follow
Here’s a tip for Unity that is going to be quick and easy, but one of the most useful things you’ll see for all your future projects. We’re going to follow our player with a virtual camera.
To get access to virtual cameras, we’re going to need to download Cinemachine from the Package Manager. Open it up with from the Window tab and then find Cinemachine.
Once this is downloaded and installed, you can add a virtual camera to your scene.
This will automatically give your Main Camera a Cinemachine Brain, which takes care of most of the background work, making your Main Camera and the new virtual camera to be one and the same.
On the actual virtual Inspector, there is an attribute called ‘Follow.’ You are going to click and drag your player object into this spot and now the player will be followed. It is as simple as that.
You can play around with some of the other settings, such as dampening and dead zone, but for the most part, that is all there is to it. Your player will now be followed by the camera as they move.