Hello guys, I want to start with Unity java script but I can`t understand it even after 2 years Action Script 3 coding. Can you help me?
I want to create a 2d array of game objects, so I wrote this:
public var grass:Transform;
public var gameobj : GameObject[];
function Start () {
for (var y = 0.0; y < 10; y++) {
for (var x = 0.0; x < 10; x++) {
var sample = Mathf.PerlinNoise(1, 1);
Instantiate(grass);
grass.transform.position = Vector3 (x, y, 0);
gameobj.Add(grass);
//Debug.Log();
}
}
}
function Update () {
}
But it will not work, I don`t understand why. How do you correctly create game objects from library? How do you push them in arrays?