i’ve made a script that moves the camera to an emty game object but it only activate one time, it only switch the camera to default location or"cameraNormal" in script.
public bool inAim = false;
public GameObject other;
GameObject cameraNormal;
GameObject cameraAim;
Camera mainCamera;
void Start(){
cameraNormal = GameObject.Find("camera1");
cameraAim = GameObject.Find("camera2");
mainCamera = Camera.main;
}
void FixedUpdate(){
if (inAim == true&& Input.GetMouseButtonDown(1))
{
mainCamera.transform.position = cameraNormal.transform.position;
inAim = false;
Debug.Log("goes to default cam");
}
else if (Input.GetMouseButtonDown(1) && inAim == false)
{
mainCamera.transform.position = cameraAim.transform.position;
inAim = true;
Debug.Log("goes to aim");
}
}