public List<Vector3> astarPath(Tile endIn)
    {
        List<Vector3> path = new List<Vector3> ();
        ;

        //Tile start= new Tile();
        Tile start = current_tile; //start tile in

        //Tile end = new Tile();
        Tile end = endIn;  //levelGrid.getTile(10,10); //target tile in

        Tile current_check_tile = new Tile ();

        List<Tile> open_list = new List<Tile> ();
        List<Tile> closed_list = new List<Tile> ();

        int g_score = 0; 				// Cost from start along best known path.
        int h_score; 					//heuristic score
        int f_score; 					// Estimated total cost from start to goal through y.

        start.setGScore (g_score);
        h_score = Mathf.Abs (end.x_pos - start.x_pos) + Mathf.Abs (end.z_pos - start.z_pos);
        start.setFScore (g_score + h_score);

        //Debug.Log("START TILE SCORE: G: " + start.getGScore().ToString() + ", F: " + start.getFScore().ToString());

        int loop_counter = 0;

        open_list.Add (start); 					//Add start tile to open list

        //while open list is not empty
        while (open_list.Count > 0) {

            //	Debug.Log("Loop counter: " + loop_counter.ToString());
            loop_counter++;

            if (loop_counter == 30)
                break;

            current_check_tile = getBestTile (open_list);			 //Get tile with lowest f value
            //Debug.Log("BEST TILE: " + current_check_tile.x_pos.ToString() + "," + current_check_tile.z_pos.ToString());

            //if the current_tile in the target
            if (current_check_tile.centre == end.centre) {
                //	 Debug.Log("Goal reached");
                closed_list.Add (current_check_tile);
                path = ConstructPath (closed_list);		//Calculate the path
                break;							//exit while loop
            }

            open_list.Remove (current_check_tile);		//remove current_tile from open list
            closed_list.Add (current_check_tile);		//add current_tile to closed list

            //	Debug.Log("CURRENT TILE: " + current_check_tile.x_pos.ToString() + "," + current_check_tile.z_pos.ToString());
            //get tiles connected to current_tile

            List<Tile> neighbors = getNeighbours (current_check_tile);
            foreach (Tile nt in neighbors) {
                //Debug.Log("NEIGHBOR TILE SCORE: G: " + nt.getGScore().ToString() + ", F: " + nt.getFScore().ToString());

            }
            foreach (Tile nt in neighbors) {
                //Debug.Log("NEIBOUR X: " + nt.x_pos.ToString() + " Z: " + nt.z_pos.ToString());

                if (closed_list.Contains (nt) || nt.getCollision () == 1)		//if tile is on closed list, move to next tile
                    continue;

                //G score of current tile
                g_score = current_check_tile.getGScore () + 1;
                //heuristic sore of current neighbor tile
                h_score = Mathf.Abs (end.x_pos - nt.x_pos) + Mathf.Abs (end.z_pos - nt.z_pos);
                //total movement score of current neighbor tile
                f_score = g_score + h_score;

                //if tile not already on open list OR f score of current n tile
                if (!open_list.Contains (nt) || f_score < nt.getFScore ()) {
                    //Set scores for neighbour tiles
                    nt.setParent (current_check_tile);
                    nt.setGScore (g_score);
                    nt.setFScore (f_score);

                    //If current neighbour tile is not on open list, add
                    if (!open_list.Contains (nt)) {

                        open_list.Add (nt);
                    }
                }
            }
        }
        return path;
    }