Advertisemen
This video will show you guys how to switch between cameras in unity in a very simple way.
Codes used in above video -
using UnityEngine;
using System.Collections;
public class camEvents : MonoBehaviour {
public Camera [] cams;
public void moveCameraOne(){
cams[0].enabled = false;
cams[1].enabled = true;
cams[2].enabled = false;
}
public void moveCameraTwo(){
cams[0].enabled = false;
cams[1].enabled = false;
cams[2].enabled = true;
}
public void moveCameraMain(){
cams[0].enabled = true;
cams[1].enabled = false;
cams[2].enabled = false;
}}
using System.Collections;
public class camEvents : MonoBehaviour {
public Camera [] cams;
public void moveCameraOne(){
cams[0].enabled = false;
cams[1].enabled = true;
cams[2].enabled = false;
}
public void moveCameraTwo(){
cams[0].enabled = false;
cams[1].enabled = false;
cams[2].enabled = true;
}
public void moveCameraMain(){
cams[0].enabled = true;
cams[1].enabled = false;
cams[2].enabled = false;
}}
Advertisemen
Tidak ada komentar:
Posting Komentar