-
Unity said me to add ‘;’ on line : GameObject mapiece = Instantiate(block, pos, Quaternion.identity) as GameObject;
-
I don’t understand why, he want just after first GameObject.
-
i try to make all my instantiate “block” child of prefab “piece” that make it.
private var PieceLargeurTaille : int; private var PieceLongueurTaille : int; //public var block: Transform; var piece : GameObject; var block : GameObject; var spacing = 2.0; function Start () { PieceLargeurTaille = Random.Range(4,8); PieceLongueurTaille = Random.Range(5,8); for (var y = 0; y < PieceLargeurTaille; y++) { for (var x=0;x<PieceLongueurTaille;x++) { var pos = Vector3 (x, 0, y) * spacing; // Instantiate(block, pos, Quaternion.identity); GameObject mapiece = Instantiate(block, pos, Quaternion.identity) as GameObject; mapiece.transform.parent = transform; } } }
Thanks