public TreasureChest SpawnChestAt(int x, int z, TreasureChest.TreasureChestTypeEnum type) { GameObject treasureObj = ItemSpawner.SpawnSmallChest(new Vector2Int(x, z)); TreasureChest treasure = treasureObj.GetComponent <TreasureChest>(); treasure.xPos = x; treasure.zPos = z; map[x, z].SetItemOnTile(treasure); return(treasure); }