I’m trying to switch between 2 different virtual cameras by pressing ‘c’ but nothing seems to happen ingame.
I have a normal camera with a cinemachinebrain and also a empty object (CinemachineMangager) with the script to change cameras and the input action.
the first person camera has priority 1 and the upAbove camera 0.
CinemachineManager:
using UnityEngine;
using Cinemachine;
using UnityEngine.InputSystem;
public class CameraSwitching : MonoBehaviour
{
public CinemachineVirtualCamera firstPerson;
public CinemachineVirtualCamera upAbove;
public InputAction action;
private bool firstPersonCamera = true;
void Start()
{
action.performed += _ => SwitchPriority();
}
private void SwitchPriority()
{
if (firstPersonCamera)
{
firstPerson.Priority = 0;
upAbove.Priority = 1;
}
else
{
firstPerson.Priority = 1;
upAbove.Priority = 0;
}
firstPersonCamera = !firstPersonCamera;
}
}
