Hi, I have the following problem.
I have this float, which im increasing by checking when a certain condition is false. Then I check whether a certain treshold is met.
The increasing part works, but when the float passes the treshold, here 25, nothing happens. When I set the float manually to a number above the treshold, the function works as expected.
I’m probably missing something really stupid, any insights on this?
regards, Rob
float car1flipped = 1;
float car2flipped = 1;
void Update () {
GameObject car1 = GameObject.FindWithTag("Bottom1");
GameObject car2 = GameObject.FindWithTag("Bottom2");
if (car1 == null)
Debug.Log("Car1 is not found");
if (car2 == null)
Debug.Log("Car2 is not found");
VehicleBottom1 sc1 = car1.GetComponent<VehicleBottom1>();
VehicleBottom2 sc2 = car2.GetComponent<VehicleBottom2>();
Debug.Log (car1flipped);
Debug.Log (car2flipped);
if (sc1.touchingGround == true)
car1flipped += (1 * Time.deltaTime);
if (sc2.touchingGround == true)
car1flipped += (1 * Time.deltaTime);
if(car1flipped >= 25 && car2flipped >= 25)
Application.LoadLevel ("Drawscreen");
}