How can I scale up the size of my world/level to include more gameobjects without causing lag for the player?
I am creating an asset for the asset store. It is a random procedural world generator. There is only one major problem: world size.
I can't figure out how to scale up the worlds to have more objects/tiles.
- I have generated worlds up to 2000x500 tiles, but it lags very badly.
- The maximum sized world that will not affect the speed of the game is around 500x200 tiles.
- I have generated worlds of the same size with smaller blocks: 1/4th the size (it doesn't affect how many tiles you can spawn)
I would like to create a world at least the size of 4200x1200 blocks without lag spikes.
- I have looked at object pooling (it doesn't seem like it can help me that much)
- I have looked at LoadLevelAsync (don't really know how to use this, and rumor is that you need Unity Pro which I do not have)
- I have tried setting chunks Active or Deactive based on player position (This caused more lag than just leaving the blocks alone).
Additional Information: The terrain is split up into chunks. It is 2d, and I have box colliders on all solid tiles/blocks. Players can dig/place blocks. I am not worried about the amount of time it takes for the level to load initially, but rather about the smoothness of the game while playing it -no lag spikes while playing.