im making an endless runner game, and everytime I play the game the runner was flickering. But at gameplay when I disable and re-enable the camera follow script component in the camera. the flickering just fixed.
so I make a method to disable the camera follow script component at the start of the game and then re-enable it after a certain amount of time just to make the flickers go away. (silly method but works just fine)
I’ve tried a lot of different way from tweaking the setting to manipulating camera object, but no other solutions. (I even uninstal & re-instal unity ==`)
So I need to know why this is happening, is it a bug? and if there is another solution I’d like to know…
I also leave the camera component setting to default.
This is the Player Script
private CharacterController controller;
private Float speed = 10;
private GameObject camFol;
private bool moving;
void Start () {
controller = getComponent<CharacterController> ();
camFol = GameObject.FindGameobjectWithTag("MainCamera");
camFol.GetComponent<CameraFollowScript>().enabled = false;
}
void Update () {
if (Input.GetKeyDown(KeyCode.Space))
controller.Move (vector3.forwad * speed * time.deltatime);
Moving = true;
if (Moving)
camFol.GetComponent<CameraFollowScript>().enabled = true;
}
&
this is the Camera follow Script
private Transform lookAt;
private vector3 startPosition;
void Start () {
lookAt = GameObject.FindGameobjectWithTag("Player").transform;
startPosition = transform.position - lookAt.position;
}
void Update () {
transform.position = lookAt.position + startPosition;
}