21 lines
520 B
C#
21 lines
520 B
C#
using Cinemachine;
|
|
using UnityEngine;
|
|
|
|
namespace Camera
|
|
{
|
|
public class CameraPlayerFinder : MonoBehaviour
|
|
{
|
|
private CinemachineVirtualCamera _cinemachineVirtualCamera;
|
|
|
|
private void Awake()
|
|
{
|
|
_cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (_cinemachineVirtualCamera.Follow == null)
|
|
_cinemachineVirtualCamera.Follow = GameObject.Find("Player").transform;
|
|
}
|
|
}
|
|
} |