so I’ve looked at other answers and tried typing code from those answers but I’m still confused where I should, A: attach the “camera swap” script and B: how I would get around the error of MonoBehavior. Also with the cameras I currently have them in a parent-child relationship b/c the create with Code live script for following the car was not working for me.
here is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cameraswap : MonoBehaviour
{
public Camera camera;
public Camera camera2;
// Start is called before the first frame update
void Start()
{
camera.enabled = true;
camera2.enabled = false;
}
// Update is called once per frame
void Update()
{
//This will toggle the enabled state of the two cameras between true and false each time
if (Input.GetKeyUp(KeyCode.Return))
{
camera.enabled = !camera.enabled;
camera2.enabled = !camera2.enabled;
}
}
}