Hello ive to following code. I know T will be always a type from the base class "Item". But i cant cast the List to Item. For T item its working.
private List<Item> activeItemList;
private Item activeItem;
public void StartBuildingSystem<T>(List<T> itemList, T item, int count, string name) where T : Item
{
UiPlacementActivate(itemList, item,count);
PlacingAreas(GetActiveBluePrint(name), GetActiveType(itemList, name));
activeBuildingType = GetActiveBuildingType(name);
activeItem = item;
//activeItemList = itemList;//
}
The code in // // doesnt work as i cant cast a List T to List Item. Any better approach? If i know the incoming List will be always from the base class "Item" but its coming from diffrent inventorys(Cooling, Secruity,....) or is there a way i can cast the List easy to Item List like it works for T item to Item.