if statement problem !

hello , i face a problem in my code
the if statement doesn’t work !!
But if i wrote (myTimer <= 10) it work perfect .
My code :

var myTimer : float = 100;
function Update() {
  myTimer -= Time.deltaTime;
  if (myTimer == 10) {


Time.deltaTime is not increasing or decreasing at a uniform rate if the Framerate is not stable, this means that the value will not always be 0, 1, 2, or so, it could be 1.32324213423 or something, your code wants to know if the timer is EXACTLY at the value 10. A way you can do this better is to check if (more than or equal to) myTimer >= 10. OR (less than or equal to) myTimer <= 10. These are best to use for the way you want to check.

Check : Unity - Scripting API: Time.deltaTime for more info on Time.deltaTime and its purpose.