Can't Get Public Variable in Code to Update from Inspector

Hello everyone - I suspect this is a quick question. I have attached some code below. I would like to be able to use this same countdown timer code across a bunch of different levels but only modify the “allowedTime” variable in the inspector. As of right now I can’t get anything I put in the inspector to update the public variable. It always locks to 90 seconds. I have tried removing the “=90” part in the script but then the timer just defaults to 0.

Any thoughts/ suggestions how to fix would be appreciated.

// the textfield to update the time to
private var textfield:GUIText;

// time variables
public var allowedTime:int = 90;
private var currentTime = allowedTime;


function Awake()
{
	// retrieve the GUIText Component and set the text
	textfield = GetComponent(GUIText);
	
	UpdateTimerText();
	
	// start the timer ticking
	Tick();
}

function Tick()
{
	// while there are seconds left
	while(currentTime > 0)
	{
		// wait for 1 second
		yield WaitForSeconds(1);
		
		// reduce the time
		currentTime--;
		
		UpdateTimerText();
	}
	
	// game over
	print("Game Over");
}

function UpdateTimerText()
{
	// update the textfield
	textfield.text = currentTime.ToString();
}

Move your currentTime = allowedTime to the awake method.

public var allowedTime:int = 90;
private var currentTime;

function Awake()
{
    currentTime = allowedTime;
    ...

That doesn’t work because the Tick() function also tries to access it. Any other suggestions?