Zig Zag / Workings
Zig Zag generates random levels, ensuring that the game feels different every time the player plays it.
Since the levels are randomly generated, only one scene is needed for the game.
The name of this scene is
Zig Zag (Random Level), and it can be found in the
Scenes folder.
Random Tilemaps
Zig Zag uses prefabs of predefined tilemap blocks that are randomly placed in a larger tilemap to create the maze.
These blocks can be found in the
Assets/Playniax/Packages/Random Tilemap Generator/Themes/Ice World/Prefabs/Tilemaps folder.

The red tiles you see are a marker indicating how much space should be between each block. This ensures that the player always has enough room to navigate through the maze. The tile palette containing the red tile can be found in:
Assets/Playniax/Framework/Essentials/Generic/Tile Palettes/Squares/Squares (64 x 64).prefabRandom Sprites
Zig Zag places all enemies and other sprites randomly within the maze after the maze was created.
Scripts
The scene named Zig Zag (Random Level) contains a GameObject called Level Builder, which has several scripts responsible for randomly generating a level.

These scripts perform the following tasks in order:
1. Zig Zag creates the level borders, which are one tile thick.
2. The borders are thickened to add visual variety to the inside of the borders.
3. The predefined tilemap blocks are randomly placed within these borders.
4. Pickups for the player are placed or "hidden."
5. Astronauts that need to be rescued are randomly placed in the level.
6. Hostile objects are randomly placed.
7. The borders are thickened again to add visual variety to the outside of the borders.
8. Tiles are randomly rotated and scaled to add visual variation.
Portals
To make the game more interesting during gameplay, a portal occasionally opens, spawning enemies.
The GameObject called Portal, is responsible for this.
See the
Portals module for more information