Can anyone tell me why I can't add to a list a wrapper containing generic class that have inheritance ?
public abstract class SectorObject{}
public class SpawnPoint : SectorObject
public class Trigger : SectorObject
public class SectorObjectList<T> where T : SectorObject { public List<T> items ; };
public List<SectorObjectList<SectorObject>> objectLists = new List<SectorObject< SectorObject>>();
SectorObjectList <SpawnPoint> spawnPoints = new SectorObjectList<SpawnPoint>();
objectLists.Add(spawnPoints); // This line doesn't work.
It works only as this :
public List<SectorObjectList<SpawnPoint>> objectLists = new List<SectorObject< SpawnPoint>>();
SectorObjectList <SpawnPoint>spawnPoints = new SectorObjectList<SpawnPoint>();
objectLists.Add(spawnPoints);
Cheers.