Files
PuzzleColorBall/Assets/Scripts/CameraController.cs

21 lines
423 B
C#
Raw Normal View History

2022-12-01 09:03:46 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public GameObject player;
public Camera camera;
2022-12-01 09:03:46 +01:00
private Vector3 offset;
void Start()
{
offset = camera.transform.position - player.transform.position;
2022-12-01 09:03:46 +01:00
}
void LateUpdate()
{
camera.transform.position = player.transform.position + offset;
2022-12-01 09:03:46 +01:00
}
}