i havent mutch knowledge about unity.
i am trying to do simple game with tilemaps for android.
I saw some examples using Scenes as level.
if i make 500 level Tilemap based , Should i use Scenes for level or another method ?
Maybe Save Tilemaps to a file and Load them into a main game scene. ?
What is the true way ?
1 Like
Well, you could do it with scenes I suppose, but that seems terribly inefficient, so saving to file and reloading seems the best idea.
So you probably want in your project 2 scenes, one is the actual game scene, the other is an editor scene. I think you can fully exclude the editor scene from your project build, but regardless you wouldn’t put any user methods to reach it, you just access it via the unity editor. In this editor scene you’d have your tilemap so you can paint it, then hook up a few functions for yourself, in particular save and load, allowing you to save a tilemap to a file or reload it if you want to edit an existing map.
Your main game would still have a the load function, but would skip the save part.
You’ll need to think up a way to encode your tiles, but that shouldn’t be terribly hard, and you’ll also want some kind of save file scheme but again that isn’t that hard. You can even just use a scheme temporarily, just retain the load code from it and change over the save code to whatever new scheme you want to replace it with.
Now, there is an alternate approach, but that needs your levels to be systematic (generated using a formula or the like), in which case you’d just store the formula in the code directly, but I highly doubt that would work for you.
1 Like