- Home /
My camera change script is not working fluently its flickering
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CameraChange : MonoBehaviour { public Camera firstPersonCamera; public Camera overheadCamera; private bool Status = false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
activatecamera();
}
public void activatecamera()
{
if (Input.GetAxis("Submit") != 0)
{
if (Status == false)
{
Status = true;
firstPersonCamera.enabled = false;
overheadCamera.enabled = true;
}
else
{
Status = false;
firstPersonCamera.enabled = true;
overheadCamera.enabled = false;
}
}
}
}
Answer by SorrowGameDev · Nov 29, 2020 at 10:47 AM
I have made it :D the soiution is to use GetButtonDown because it changed between the cameras so fast that it looked like it was flickering but thank you for you answer.
Answer by wolfenswan · Nov 29, 2020 at 10:44 AM
What exactly is flickering? Do you mean it's constantly changing between overhead and first person, or is it flickering within either (or both) of those states? If the latter, what's the code for camera movement in those respective states?
Also, what input is governing the "Submit"-Axis?