Skip to content

Instantly share code, notes, and snippets.

@onlyoneaman
Created November 8, 2021 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlyoneaman/4ba3d39b7527fdd4795fa474a8db2ce8 to your computer and use it in GitHub Desktop.
Save onlyoneaman/4ba3d39b7527fdd4795fa474a8db2ce8 to your computer and use it in GitHub Desktop.
Camera Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public GameObject player;
private Vector3 offset;
// Start is called before the first frame update
void Start()
{
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void LateUpdate()
{
transform.position = player.transform.position + offset;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment