hex grid A* pathfinding... type argument error


Staff member
I'm a budding programming enthusiast and game designer studying to finish my degree, and thus am still quite new in the world of programming. I've done a fair amount of JavaScript (actually UnityScript) and now am trying to dabble in C#. I have been following hakimio's tutorial of making a turn-based RPG in Unity, which is based on a hexagon grid using A* pathfinding. (http://tbswithunity3d.wordpress.com/)

My question is that I have followed his tutorial step-by-step up to the point of finishing the A* pathfinding scripts and assets, but have come across the error in Unity:

"error CS0308: The non-generic type `IHasNeighbours' cannot be used with the type arguments"

This is the code that sparks the error message, on the line
public class Tile: GridObject, IHasNeighbours<Tile>

using System.Collections.Generic;
using System;
using System.Linq;
using UnityEngine;

public class Tile: GridObject, IHasNeighbours<Tile>
public bool Passable;

public Tile(int x, int y)
    : base(x, y)
    Passable = true;

public IEnumerable AllNeighbours { get; set; }
public IEnumerable Neighbours
    get { return AllNeighbours.Where(o => o.Passable); }

public static List<Point> NeighbourShift
        return new List<Point>
            new Point(0, 1),
            new Point(1, 0),
            new Point(1, -1),
            new Point(0, -1),
            new Point(-1, 0),
            new Point(-1, 1),
public void FindNeighbours(Dictionary<Point, Tile> Board, Vector2 BoardSize, bool EqualLineLengths)
    List<Tile> neighbours = new List<Tile>();

    foreach (Point point in NeighbourShift)
        int neighbourX = X + point.X;
        int neighbourY = Y + point.Y;
        //x coordinate offset specific to straight axis coordinates
        int xOffset = neighbourY / 2;

        //if every second hexagon row has less hexagons than the first one, just skip the last one when we come to it
        if (neighbourY % 2 != 0 && !EqualLineLengths && neighbourX + xOffset == BoardSize.x - 1)
        //check to determine if currently processed coordinate is still inside the board limits
        if (neighbourX >= 0 - xOffset &&
            neighbourX < (int)BoardSize.x - xOffset &&
            neighbourY >= 0 && neighbourY < (int)BoardSize.y)
            neighbours.Add(Board[new Point(neighbourX, neighbourY)]);

    AllNeighbours = neighbours;

Any help or insight on how to get past this error would be greatly appreciated, I've struggled over this script for the past few days trying to get it to work, and can't proceed with the tutorial (and my project) with the error.

Thanks in advance everyone!

Aaron :)