-1

我在移动平台上收到此错误:“GetComponent”在移动平台上不是“对象”的成员,但在 Windows 上工作正常。请帮我解决这个问题。提前谢谢。:D

for (stage = 2; stage <= cells.length; stage++) 

{

for (i = 0; i <= cells.length - 1; i++) 

{ 



if (doorsToCells[i] == stage - 1)

for (var checkDoor : GameObject in cells[i].GetComponent(AIpathCellScript).… /*is is the line with error*/

{

if (checkDoor != gameObject)

{

for (var checkCell : GameObject in checkDoor.GetComponent(AIpathDoorScript)…

{

for (var j : int = 0; j <= cells.length - 1; j++)

{

if (cells[j] == checkCell && doorsToCells[j] == null)

doorsToCells[j] = stage;

}
}
}
}
}
}
4

1 回答 1

0

首先,您需要将变量转换为您想要的类型......在这种情况下为 GameObject

第二你的循环似乎是错误的......你在一个脚本组件中循环游戏对象,这真的很奇怪......(除非你没有显示你的所有代码)

于 2012-08-23T10:31:06.823 回答