Method not updating varible

I have the method build that is called from another script and it’s supposed to update the timeBuilt variable so I can us it for checking. The problem is that it’s not updating that variable. The first debug is the timeBuilt variable I use to check the time and it’s always 0 although it should be updated. The second debug also uses the timeBuilt variable but the timeBuild variable is updated like it used another variable but it’s using the same.

SCRIPT:

using UnityEngine;
using System.Collections;

public class Building : MonoBehaviour {

	public float buildTime;
	private float timeBuilt;
	
	private bool built;
	public bool Built{
		get{
			return built;
		}
	}

	private bool enemy;
	public bool Enemy{
		get{
			return enemy;
		}
	}

	void Start(){
		built = false;
		if(buildTime <= 0){
			built = true;
		}
	}

	void Update (){
		Debug.Log(timeBuilt);//First debug | Allways zero but should be updated
		if(timeBuilt >= buildTime){ 
			transform.Find("BuildingMesh").gameObject.renderer.enabled = false;
			transform.Find("Mesh").gameObject.renderer.enabled = true;
			built = true;
		}
	}

	public void Build (){
		Debug.Log(timeBuilt);//Second debug | Is updated as it should but seems to use an indepentad timeBuilt.
		timeBuilt += Time.deltaTime;
	}
}

The first debug is the timeBuilt variable I use to check the time and it’s always 0 although it should be updated.

Looking at this code. I’d expect the first Debug.Log(timeBuilt); to be 0, since you haven’t updated timeBuilt yet. Now, using deltaTime might not give you what you expect if you aren’t calling it from some other MonoBehaviours Update function, since it gives you the time since the last frame… not the time from the last time you called deltaTime.