I am currently working on an endless runner in which I have a set of obstacles that get created randomly outside of the screen while running.
The obstacles are tilemaps and are placed in a separate layout.
Now the game runs quite smooth on mobiles, but with every obstacle that spawns I experience a small lag. Summed up for every obstacle
that spawns it results in a laggy experience.
I tried the following to solve this problem:
1.) I tried to place all the obstacles inside the main layout. I was expecting the Loader Layout to preload all of them so that spawning an obstacle
doesnt create a lag anymore. However, the result was a drastic constant frame drop to about 5 fps.
2.) Tried to preload the obstacle layout from the layout loader and jump into the main layout after completion. However, when a layout it changed, all preloaded images get removed from memory again. This also means that with every new game session, all obstacles need to be loaded again.
Happy for every input...