0
\$\begingroup\$
using System;
using UnityEngine;
using UnityEngine.UI;
using Cinemachine;

public class CameraSwitch : MonoBehaviour
{
    public CinemachineVirtualCamera vcam;
    public CinemachineFreeLook fcam;
    
    private void Update()
    {
        if(Input.GetKeyDown(KeyCode.V))
        {
            fcam.enabled = false;
            vcam.enabled = true;
        }
    }
}

When pressing on the V key it's switching between the cameras. I want that if I will press on the V key again it will switch between the two camera back fcam to be true and vcam to be false and so on each time pressing on the V key to switch between the cameras.

\$\endgroup\$
2
\$\begingroup\$

I'm assuming you tried something simple like this?

private void Update()
{
    if(Input.GetKeyDown(KeyCode.V))
    {
        fcam.enabled = !fcam.enabled;
        vcam.enabled = !vcam.enabled;
    }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .