- Home /
No relevant answers provided
Unity - Long load time after pressing play button
Hi,
I have a scene for my 2D game that uses tiles to recreate the level, the problem is that it takes me around 48,000 tiles to make a map that is nowhere near is a big as I would like. Loading all of these tiles at runtime takes Unity about 30 seconds, which is like waiting a year when you are just making small adjustments to your code.
So my question is, how can I speed up the load times on massive 2D levels in unity? Should I perhaps split the world into chunks at runtime and only load the ones around the player, or is there another easier way.
Thanks for any help.
Answer by KubaPrusak · May 29, 2015 at 04:26 PM
I assume you are generating these tiles at startup (void Start()). This uses a lot of CPU which is making you wait. If you are then there is no way to make the process faster. You would have to generate tiles in the Update() and generate the tiles when the player comes near to ungenerated regions.
The tiles are not generated by a script, they are simply placed in the scene view using a custom tile placing script.
Oh so you already have a set of tiles in the scene view, and then their position gets changed by the script. If you are doing something a lot of times (ie 48000) it will considerably slow down the startup. I suggest that you only do this process when the player gets near the unplaced tiles.
No script is attached to the tile GameObjects, Sorry if the last comment was unclear, but there is a script that only runs in the editor that allows me to click a place in the scene view and a tile gameObject will be instantiated at the point.
The only solution to such a problem is to load the tiles in chunks and only load chunks around the player.
Follow this Question
Related Questions
Display spinning icon while some search method in progress ? 0 Answers
Issues with my loading screen 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers