Simple generation (new to unity)

So I have this dodge the obstacle 3d game, but is there any way to code level generation, so i don’t have to make it manually, can anyone please link me a good tutorial?
I’ve looked for some on youtube but i can’t find the right one for my project.
It just has to spawn my enemy obstacle on the x axis and has to have a decent z distance so the player can pass through.
My game is basically just a baseplate with a cube (as the player) which has to avoid to collide with the enemy.
I also have a problem where if i touch the obstacle once, it counts for 2 hits?

Can anyone help me out?

Thanks!

Think this is what you lookin for?:

(this is 2d but 3d and 2d can be applied similarly)
As for enemies you gonna have to look for a video on that, whereas you can use an ontriggerenter method on an obstacles and subtract your players health by 2.