public void SetDataInObject()
{
if (j < ObjList.objects.Count) //count is approx 300
{
for (int k = 0; k < allObjs.Length; k++) // Length is 10
{
stCalc = uiMana.floorStats[k].GetComponent<StatesCalc>();
for (int m = 0; m < allObjs[k].floorObjs.Length; m++) //Length is 80
{
string serverObj = ObjList.objects[j].name;
string localObj = allObjs[k].floorObjs[m].gameObject.name;
if (localObj == serverObj)
{
ObjManager curObjManger = allObjs[k].floorObjs[m].GetComponent<ObjManager>();
//Logic to set data in local objects
}
}
}
j++;
SetDataInObject();
}
}
[在Unity c#中,我从json中获取数据,并且正在使用嵌套循环(如下代码)查找/比较游戏对象,以在本地游戏对象中设置该数据。但是在...
SetDataInObject()
内调用SetDataInObject
而无法中断循环-因此您会得到堆栈溢出。 A
调用A
,然后调用A
,又调用A
,然后...