Curiosity over script lifetime and update

Does anyone know how unity run the script. At first I think that unity read through the script time after time like a loop but when I wrote this

using UnityEngine;
using System.Collections;


public class LightScript: MonoBehaviour  {
	Light Ist;


	void Yahoo(){
		int z=5;

		Debug.Log ("Num "+z);
		z += 5;
	}
	void Start () {


		
		Ist = GetComponent<Light>();
	}
	void Update () {

		Ist.enabled = false;	

	}
}

I think it should update the

over time but it doesn’t. Anyone knows the answer plss help. Thanks in advance

The function Yahoo isn’t being run. Also, you’d reset the variable z each time you invoke the function.

Unity just looks for all MonoBehaviours in your scene and calls the standard functions on these objects.

Unity runs Update() every frame, but any function you create yourself (such as Yahoo) must be called manually by you for it to ever be called.

This link should give you a little more information: