make camera follow object in unity code example
Example: how to make a camera follow an object in unity 2d
public Transform player; public Vector3 offset; void Update () { transform.position = new Vector3 (player.position.x + offset.x, player.position.y + offset.y, offset.z); // Camera follows the player with specified offset position }