private void FixedUpdate() { if (tree != null) { healthText.text = "Tree Health: " + tree.GetHealth(); } }
private void OnTriggerEnter(Collider collision) { if (collision.tag == "Tree") { tree = collision.GetComponent <TreeHealth>(); healthText.enabled = true; healthText.text = "Tree Health: " + tree.GetHealth(); } }