40 lines
833 B
C#
40 lines
833 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraSwitch : MonoBehaviour
|
|
{
|
|
|
|
public GameObject FrontView; //Cam 1
|
|
public GameObject ThirdView; //Cam 2
|
|
public int cam = 1;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
FrontView.SetActive(true);
|
|
ThirdView.SetActive(false);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if(Input.GetKeyDown(KeyCode.R)) {
|
|
changeCamera();
|
|
}
|
|
}
|
|
|
|
public void changeCamera() {
|
|
if(cam==1) {
|
|
ThirdView.SetActive(true);
|
|
FrontView.SetActive(false);
|
|
cam = 2;
|
|
}
|
|
else {
|
|
FrontView.SetActive(true);
|
|
ThirdView.SetActive(false);
|
|
cam = 1;
|
|
}
|
|
}
|
|
}
|