Unity game crash after upgrade to 4.x

Started to learn Unity and make a game about a year ago. Back then I used Unity 3.x.
After a couple of weeks I put the game on hold until now. Upgraded to Unity 4, and now the project crashes. I’m 100% percent sure it still works in 3.x but not in 4.x. I’m totally lost what the problem is, so hopefully someone here can help me.
I’ve found where it crashes, but I dont know why. This is the “faulty” script:

#pragma strict

import System.Collections.Generic;

class AIPlayer {

	private static var Instance : AIPlayer;
	private var GM : GameManager;
	private var GB : GameBoard;
	
	var DisplayName:String;
	var MemoryLossStep:int;
	var MinMemory:int;
	var MemValues : int[,];
	
	public static function GetInstance() : AIPlayer {
		if (Instance == null)
			Instance = new AIPlayer();
		
		return Instance;
	}
	
	private function AIPlayer() {
		
	}
	
	function Init() {
		GM = GameManager.GetInstance();
		GB = GameObject.Find("Board").GetComponent(GameBoard);
		
		// Init MemValues for every tile on the path
		MemValues = new int[GB.PathArray.Count,4];
		for(var y:int = 0; y < GB.PathArray.Count; y++) {
			for (var x:int = 0; x < 4; x++) {
				MemValues[y,x] = 100;
			}
		}
		
	}
	
	function Move() {
		var clickTile:GameObject;
		var highestRoll:int = -1;
		var memValueRoll:int;
		
		for(var tmpTile in GB.ClickableTiles.Keys) {
			memValueRoll = Random.value * MemValues[GM.PlayerPos,GB.ClickableTiles[tmpTile]];
			if(memValueRoll > highestRoll) {
				highestRoll = memValueRoll;
				clickTile = tmpTile as GameObject;
			}
		}
		
		clickTile.GetComponent(Tile).OnMouseDown(); // THIS IS WHERE UNITY CRASH
		
	}

}

I’ve marked the line in the code where it crashes.
OnMouseDown is a public function in the script Tile.js.
And as I said, it works just fine in Unity 3.x.
Any help is much appreciated.

Update:
So I found what was causing the crash, and it wasn’t what I though. My mistake, read the crashlog wrong. It was how you use yield WaitForSeconds that has changed. Now I’m just going to figure out how to use it properly :slight_smile: