Random maze only uses a random seed when dragged to the scene

This is a very basic thing that I’m struggling to make it work.

I’ve been using unity for ~1 year, one of my last projects there was a random maze. You can see how it works in the gif: Imgur

The detail is, as you can see in the gif, the maze generation starts when I press spacebar. This means I can hit space again anytime and it will restart the generation and create a totally different maze. Very straight forward. I found a good tutorial on how to make a random maze using UE4 blueprint visual scripting feature (link here) and it works great, it uses a random stream to generate a seed, so the maze is (or should be) different each time.

But, when I finished the blueprint, I’ve found out that the only way to make a maze with a random seed is dragging it into the scene. I then tried to make a “target” component spawn the maze blueprint using the “Spawn actor from class” node (as I’ve used an empty game object to spawn the maze prefab on unity), but it just spawns the same maze because it uses the default value of the random stream (0). GIF showing me dragging the blueprint from Content Browser to the scene and then using R to call the little script on the image linked above.

How can I replicate the action of “instantiation by dragging a blueprint from the Content Browser to the scene” on UE4 visual scripting tool/visual studio?

Thank you!

not sure if itll help but the picture below shows some node that may be of use (the ones on the right are from Ramas victory plugin).

as for the last part of your question, when a actor is dragged in to the scene the contruct event is run then when you start the game the begin play event is run so basically both are just events so you could create your own custom event in theory to accomplish what your looking to do.

Thank you for the answer, your last paragraph helped me find a solution.

First I moved the entire maze generation that was on “ConstructionScript” to “OnBeginPlay”. Thats how it is now: “OnBeginPlay” call a new seed and then goes to maze generation script. With that in place, the maze is generated when the level is loaded. Then just link the “Input R” to reset level. Now i have a new maze everytime i press ‘R’ ( Imgur )! The only inconvenience is that i need to simulate on a standalone window, if i press ‘R’ when im simulating on the editor it just exits the play mode. But thats not a problem at all.

Thank you again!

Don’t know if you are aware or not but you can actually create a custom event and check the box “Run In Editor”. It’ll then create a button in the details panel titled whatever your custom event is named and when pressed will run it in the editor. Really great for testing procedural generated stuff or even random stuff.