Randomly Generated Level

I’m working on an infinitely generating level by having prefabs I made containing obstacles in a tube form in front of the player as he progresses forward. I’m having trouble with this method and I’m starting to wonder if this is the best way to do this.

I was just hoping I could get some input on what would be the most efficient way to make a infinitely generating level. Maybe prefabs weren’t meant to do what I’m trying to make them do?

Actually I think prefabs are ideal for this, because it sounds like you want to keep generating more and more of them as the player progresses, maybe such that each has somewhat different characteristics (like position, scale, rotation, color, etc.). So the level would gradually get harder based on these parameters. More info about the kinds of problems you’re having might help us understand better.

Also, you should definitely have a means to destroy objects when the player is past them (assuming the player can’t go back to them), because each new object eats up more memory and processing and your game will eventually get really slowwww…

That’s why he shouldn’t destroy them.

Use object pool’s. Actually the best way to do infinity level is use prefabs and forget about Instantiate function. I guess your problem that you have “lags” when instantiating prefabs in front of player. If so, pool’s will solve problem for you. But if you have another problem, please describe it.