Hello,
I’ve run into a slight problem, well… here’s the problem.
I’m making a script to cut down trees,
Each tree has it’s own log count.
I want to Instantiate amount of objects = log count,
Any help would be greatly appreciated.
Thanks for reading!
var MaxLogs = 100; // Max logs of tree var Logs = 0; //this doesn't matter var Tree : GameObject;//type of tree function TreeDead () { // Instantiates 10 copies of prefab each 2 units apart from each
other
var prefab : Transform; for (var i : int = 0;i < 10; i++) { Instantiate (prefab, Vector3(i * 2.0, 0, 0),
Quaternion.identity);
}
}
Instead of Instantiates 10 copies of prefab, i want it to Instantiates amount of logs, so if var Logs = 4; Instantiates 4 copies of prefab