实例化在Android上不起作用

时间:2014-08-28 19:31:25

标签: c# android mobile unity3d

我在网格中实例化预制件。这在PC上运行良好,但在我的Android设备上没有任何作用。有什么建议吗?

public GameObject box;
public int amountOfBoxes = 13;
public int[,] grid = new int[13,4];

private int x;
private int y;
private int i;

void Start () {
    i = 0;
    while (i<amountOfBoxes){
        x = Random.Range(3, 9);
        y = Random.Range(0, 4);
        while(grid[x, y] == 1){
            x = Random.Range(3, 9);
            y = Random.Range(0, 4);
        }
        grid[x, y] = 1;
        Instantiate(box, new Vector2(x * 2.0F, y * 2.0F), Quaternion.identity);
        i++;
    }
}

0 个答案:

没有答案