click on Main Camera –> go to Inspector window –> click on Add components –>new Script –>Name the script(CameraController). Go to inside the Project Window. Now, paste the following code into your script. If you were created script from Project window then drag and drop the script on Main Camera.
How do I set my camera to follow my player?
All you need to do, is make the Main Camera a child of the Main Character object (drag and drop in the hierarchy menu.) Then, set the camera’s transform to (0, 0, -1.5). As a child, the camera will move when the player moves, and it’s position will use the player’s position, modified by the -1.5.
How do you make a camera follow an object in Unity 3d?
Create a virtual camera from the Cinemachine menu. Click on the newly created virtual camera. Arrange your camera position, rotation or other settings as if it is your main camera. Then assign your target object to the Follow slot.