Hello again. This problem has been bugging me in every scene I try to make. So basically I have a timer variable(a float) and any other variable(an int or bool). So what i want to do is based on the value my timer variable has, the value of another variable will change. Example “if(timer >= 10.0f){ goal = true; }” or something like that. Here’s some of my code and a screenshot of what I mean to further explain(also ignore the missing script error, that’s for something else):
public int posNum;
public float cameraTimer;
public bool isIdle = true;
public bool isViewing = false;
// Update is called once per frame
void Update () {
cameraTimer += Time.deltaTime;
if(isIdle){
//Sets camera position number
if(cameraTimer == 0.1f){
posNum = 0;
}else if(cameraTimer == 8.2f){
posNum = 1;
}else if(cameraTimer == 16.1f){
posNum = 2;
}
IdleCam();
}
if(isViewing){
}
}
As you can see the cameraTimer has passed 8.2f and the camPos variable has not been set to 1. How do I fix this?
Thanks.