Best way to go about randomly creating levels?

Hey everyone!

I’m making a game and would like to include an endless mode.

How it would work is like this: 1 “level” is made up of 10 or so “rooms” (rooms are just prefabs that get created that have walls, enemies, objects, etc. that I make in advance).

I have a couple of ideas:

  1. When the player loads into the level it randomly chooses the 10 rooms and creates them.
  2. When they proceed through a door (which only opens when all enemies are defeated), it chooses a random room and creates it.

Which one of these options do you think would be a better idea or can you guys think of some?

If you search for “unity random levels tutorial”, there are lots of examples for 2D and 3D.