Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CameraSwitcher : MonoBehaviour
- {
- //get camera inputs
- public Camera camera1;
- public Camera camera2;
- void Start()
- {
- //activate default camera
- camera1.enabled = true;
- camera2.enabled = false;
- }
- void Update()
- {
- //switch camera from key press
- if (Input.GetKeyDown(KeyCode.Space))
- {
- camera1.enabled = !camera1.enabled;
- camera2.enabled = !camera2.enabled;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement