Infinite Runner effeciency

Good Day

i have been following Unity Live tutorials and also checked the archives and looked others in you-tube. I m interested in infinite Runner type of game. i looked at the examples and i see they create the environment for the character on-fly during the game. in all examples i see that the things like obstacles get created and a trigger is created to dispose them. also the environment gets created as the character runs. i also saw another approach which i doubted if it was efficient. The demonstration actually created the ground that looks like its moving at a certain speed and the third-person controller had to look like he is running and the obstacles are spawn into the game dynamically. i saw the hierarchy window generating lots of objects. i checked the task manager to check how quickly the resources are consumed. it was not that bad but i am just thinking with assets that are complex not made from a cube how will this go expansive.

So my Question is , what is the efficient way to create an infinity Runny game?

Both approaches are equally valid, and will work.

For the case where you’re moving the the obstacles and background, but keeping the player still, you’re moving more objects than you would in the case where you move the character, so it might be a bit more resource intensive. That being said, your obstacles should be simple shapes - cubes in 3D, simple polygons and boxes in 2D - so it shouldn’t be a problem.

Do whatever you think it’d be the easiest to code.

A good solution is pooling for this, if you are creating and killing lots of objects that will cause the garbage collector to kick in pretty hard core and cause the game to stutter. So instead using existing objects and keep moving up infront of the player.

Also instead of moving the world around the player i was successful and moving the player, and having everything warp back to 0 0 0 once you get too far away from the world origin for floating point accuracy to be a problem

Good Day

Thank you for the advice , it is valuable