Hi people.
I am coding a snake game in unity and i am having problems with it.
First, I want to instantiate some prefabs in a specific pattern which would be the length of the snake.
That would be the solution but…
tar: Transform;
function Update() {
for (var i=0; i <= snakeSize; i++) {
Instantiate(tar, Vector(tar.transform.position.x + i, 1, tar.transform.position.z),
Quaternion.identity));
}
But the problem is that the instances keep being created until the program crashes. I tried everything, putting loops and if statements to stop the instantiation process but it never stops.
And second, what would be the best way to create instances with different names, ids?
are there some ways to create different tags through scripting?
Thanks for any help further.