Hi,
I am currently making a 2d endless runner in Unity, the current implementation of which involves moving the camera at a constant rate while dynamically spawning the environment off-screen to the side of it. Unfortunately, this seems to cause some wonky issues after the camera passes the ~10,000 x value.
I have 2 ideas for a solution to this problem, and would like your guys’ input as to which one is better (and I’m open to other ideas, as well).
Solution 1: Continue moving the camera, but once the camera passes 9,999 “snap” it back to 0 along with the current environment on-screen; reset positions for upcoming spawning environment so it spawns in the proper location. This is a bit of a hack, but involves very little additional data overhead
Solution 2: Move the world, while keeping the camera in place. Has additional overhead of moving all the environment, but does not require any hack to make the game endless.