Delay after setting mainTexture

Gday all,

I am having trouble with a quick project I am trying to finish off in the next few hours… It isnt game breaking but it is a bit annoying.

Webplayer:
https://dl.dropboxusercontent.com/u/74159983/Frogpad/Frogpad.html

It is a basic boardgame where you play a frog, after you roll, the frog jumps to the next square. I am simulating a jump just by changing textures but for some reason there is a very noticeable (2-3 second) delay between changing the texture and executing the next part of the code. (Immediately evident if you look at webplayer)

The code I am using is:

currentPlayerScript

function Start () {
	renderer.material.mainTexture = normalFrog;
}

function Update () {

}

function Jump(){
	renderer.material.mainTexture = jumpingFrog;
}


function Land () {
	renderer.material.mainTexture = normalFrog;
}

function Splash () {
	renderer.material.mainTexture = splashFrog;
}

function SetPlayer(){
	isHuman = true;
}

Key part of movement function

currentPlayerScript.Jump();

var distCovered = (Time.time - startTime) * moveSpeed;
var fracJourney = distCovered - distanceToMove;

while (!done){
	distCovered = (Time.time - startTime) * moveSpeed;
	fracJourney = distCovered - distanceToMove;
	currentPlayer.position = Vector3.Lerp(startLocation, moveLocation, fracJourney);
	yield;
	if (fracJourney > 0.99){
		done = true;
		currentPlayerScript.currentSquare = newPos;
		}
}

Full function in movement script

function MoveCharacter(i : int){
	turnState = 2;
	
	var newPos = currentPlayerScript.currentSquare + i;
	if (newPos > boardSquares.Count - 1){
		newPos = boardSquares.Count - 1;
		}
	if (newPos < 0){
		newPos = 0;
		}
	
	var moveLocation = boardSquares[newPos].transform.position;
	moveLocation += currentPlayerScript.safetyOffset;
	var distanceToMove = (currentPlayer.position - moveLocation).magnitude;
	var startLocation = currentPlayer.position;
	
	var moveSpeed = 1;
	var startTime = Time.time;
	
	var done = false;
	
	currentPlayerScript.Jump();
	
	var distCovered = (Time.time - startTime) * moveSpeed;
	var fracJourney = distCovered - distanceToMove;
	
	while (!done){
		distCovered = (Time.time - startTime) * moveSpeed;
		fracJourney = distCovered - distanceToMove;
		currentPlayer.position = Vector3.Lerp(startLocation, moveLocation, fracJourney);
		yield;
		if (fracJourney > 0.99){
			done = true;
			currentPlayerScript.currentSquare = newPos;
			}
	}
	
	if (boardSquares[newPos].waterSquare){
		currentPlayerScript.Splash();
		moveMod = -1;
		RunTurn();
	}
	else { 
		currentPlayerScript.Land();
		moveMod = 1;
		EndTurn();
		}
	
	
}

I have no idea why it is doing this other than maybe a delay with changing the texture, but the actual texture change is instant… it is the delay afterwards which confuses me (I would have thought if there would be a delay, it would be as the texture was changing, not afterwards?)

Any help is greatly appreciated!

Your Lerp is wrong, it looks like it’s to do with the calculation of fracJourney which should be:

 fracJourney = distCovered/distanceToMove;