- Home /
Question by
TheIrishKraken · Jul 24, 2020 at 05:29 AM ·
2d arrayinstantiate-game-object
Instantiate an array of 2d platforms
Hello
I have an array of 2d platforms that I want to instantiate one after another at run time so that it looks like an infinate 2d runner. Each platform is 15px wide so I guess I want to spawn every new platform 15 units after the last platform. This is the method I have coded so far:
public GameObject plainPlatform; public int nextPosition = 15;
void BuildLevel() { for (int i = 0; i < 1000; i++)
{ Instantiate(plainPlatform, new Vector3(nextPosition, 0, 0), Quaternion.identity); }
}
Comment
Your answer
Follow this Question
Related Questions
how can I stop instantiate process 1 Answer
String[,] returns wrong value in recursion 0 Answers
Spawning 2D objects randomly and infinitely 1 Answer
Co ordinates issue 0 Answers