Need advice for multi-level tile map

Hi, I’m relatively new to Unity but I am a very fast learner. I am currently experimenting with all kinds off stuff, mainly 2D, and right now I’m trying to create a top-down 2d shooter with a tilemap, much like Crimsonland (if anyone still remembers that game). What I am trying to achieve though, is a kind of multi-level map to walk around. Or maybe multi-story would be more clarified for understanding.

So I have the main level, say 128x128 tiles, and then I want to have a stair or a cave leading to an underground level, maybe even a few of those. How would I go about implementing those in 2D Unity?

In the end, I would like to generate those underground levels procedurally (I can already do that on the first level), and then have like, the top level become invisible when the main hero is underground, but switch freely between levels, and so that if I have an opening, like a pit, then I can see through from the top level to the level beneath it. Also, part of the squad may stay above to guard the entrance or something like that, which is one of the reasons I don’t want to use separate maps for each level.

You could try doing it with Sorting Layers. Something like BackgroundLevel2<BackgroundLevel1<CurrentLevel<Characters and use the Order in Layer for the rendering order within each level.
Each time you move up or down just shift the Sorting Layers. You will also have to do the same with layers for physics so the collision stuff works properly. You will probably run into other problems I can’t think off right now so just create a simple prototype and start testing.

You can do that quite easily with SpriteTile, where you would activate/deactivate layers with the SetLayerActive function, and procedurally generate levels with the various SetTile functions.

–Eric