For loop 迭代对象列表的过程不顺利
我试图在Unity3D中查看游戏对象列表,但它返回以下错误: Assets/Scripts/OrganizarTilesEmMatriz.cs(45,18):错误CS1525: 意外符号foreachFor loop 迭代对象列表的过程不顺利,for-loop,unity3d,iteration,For Loop,Unity3d,Iteration,我试图在Unity3D中查看游戏对象列表,但它返回以下错误: Assets/Scripts/OrganizarTilesEmMatriz.cs(45,18):错误CS1525: 意外符号foreach( List<List<GameObject>>tilesOrganizadosPorColuna=new List<List<GameObject>>(); List<List<GameObject>> organiza
(
List<List<GameObject>>tilesOrganizadosPorColuna=new List<List<GameObject>>();
List<List<GameObject>> organizarTilesEixoY()
{
List<List<GameObject>> temporario = new List<List<GameObject>>();
foreach(<List<GameObject>arraylist in tilesOrganizadosPorColuna){
temporario.Add(arraylist.Sort(new CustomComparer());
}
return temporario;
}
class CustomComparer : IComparer
{
Comparer _comparer = new Comparer(System.Globalization.CultureInfo.CurrentCulture);
public int Compare(object x, object y)
{
// Convert string comparisons to int
return _comparer.Compare(Convert.ToInt32(x), Convert.ToInt32(y));
}
}
foreach(<List<GameObject>arraylist in tilesOrganizadosPorColuna){
foreach(List<GameObject> arraylist in tilesOrganizadosPorColuna){