Strange increment counter

Hi guys.

I have a variable that is incrementing dependent if the player is holding down the “E” key. It will increment this variable based on a transfer rate. This transfer rate variable is essentially the speed it is incrementing. I am basically passing the transfer rate through as parameter, then incrementing by mulitplying by Time.deltaTime , so that i get an increment every second rather than every frame.

However for some reason when i change the transfer rate variable it doesnt change the speed of the increment. BUT if i replace the variable with an explicit number it works. …

I dont know why this happens. I have one update method in one of my scripts and the other holds the increment function and keeps the lifeessnce within a range. The transfer rate variable is passed through as parameter.

Script 1

var transferRate:float = 50.0;

// Retrieves the second script attached to this object
var essenceCarrier:Essence_Handler = this.gameObject.GetComponent(Essence_Handler);

function Update {
if(Input.GetKey(KeyCode.E)) {

Script 2 (Essence_Handler)

var lifeEssence:float = 0;

var minEssence:float = 0;

var maxEssence:float = 100;

function Update () {
	lifeEssence = Mathf.Clamp(lifeEssence,minEssence,maxEssence);

function addEssence(transferRate:float) 
	lifeEssence += (transferRate*Time.deltaTime);

As you can see it passes through to the second script as a parameter, but it doesnt go faster if i change transfer rate in the first script. BUT if i do this in the second script , it does change the speed of the increment of “lifeEssence”.

function addEssence(transferRate:float) 
            //EXPLICIT VERSION
	lifeEssence += (50*Time.deltaTime);

Would really appreciate why this is happening and a solution to this problem, thanks alot.

Public variables get their value from the inspector. Changing the variable’s value in the script won’t do anything (aside from providing the default value for when a script is first attached to an object, or when you use Reset). This allows for quick experimentation, where you can change values in the inspector without having to recompile scripts.