Hi people, I’m having a lot of trouble with something.
I have an ortographic camera, which when given the conditions I move to another point from one frame to the other. This means the movement is instantaneous and should not give any kind of problem.
The problem is, that whenever I press the button which moves the camera from a fixed point to another, there is a 1ms (just to say) flicker. This flicker is like a black screen that lasts 1 frame, and sadly enough to perceive with the eye.
Does anyone know something about this? A workaround? A fix?
The only thing i can think of is the refresh rate or the texture quality. Either one of those could be causing the flickering, try editing some values maybe in the ‘Render Settings’
I hope this helps, let me know the results.
No problem, flags are just a fancy way of saying a global variable.
You could do something like:
var newScene : int = 0;
function changeScene(int id) {
case 1:
case 2:
case 3:
newScene = id;
break;
}
function moveCamera() {
switch(newScene){
case 1:
// Scene 1
gameCamera.transform.position = Scene1.transform.position;
break;
case 2:
// Scene 2
gameCamera.transform.position = Scene2.transform.position;
break;
case 3:
// Scene 3
gameCamera.transform.position = Scene3.transform.position;
break;
}
}
function FixedUpdate() {
if (newScene != 0) {
moveCamera();
}
}
Something of this sort may prevent the flickering.
Edit: You would still call changeScene from other code to move the camera. Then this script would take care of delaying the call until the end of the frame.
Edit: Changed LateUpdate to FixedUpdate as pointed out by @kevinseligmann