Not sure of the best way to regenerate levels upon goal completion/losing

Greetings, programs!

My game levels are completely generated by a C++ class. At the end of the level, I would like to either regenerate the level with the same parameters if the player loses, or regenerate a slightly more difficult level if the player succeeds.

I’m having a hard time as far as figuring out the best way to implement this. There are several possibilities here. Ideally, I’d like every generation to be different. Right now my generation code is in the Construction Script which gives the benefit of being able to see the level in real-time as I make changes in the editor, but for true randomness, it seems to work better if I have the level generated during the OnBeginPlay event (with the cost of not being able to get an editor preview.) If I try to put the generation code in both, then I end up with two levels generated on top of each other, which doesn’t work out, obviously. Although I just got thinking that maybe I could destroy the level and regenerate it again with the OnBeginPlay event? Hmmm…

Anyway, if you have a similar situation, how have you done it? I’m trying to write this while deep in thought, so if I’m not clear on anything, just ask and I’ll be happy to clarify.

Thanks!

Just for fun, I tried what I said. Functionally, it does what I want, but I’m now not able to move around. I can LOOK around, but not move. All my other controls work just fine, too (flashlight on and off, my debugging level reset button, etc… just not movement.)

Another option is to tell the editor to open the level your playing on as though it we opening it for the first time, you could then duplicate your levels to make them a little bit harder then just have the editor open the different levels if the player fails.