Level Blueprint : Event Begin Play fired twice

Hi everyone,

I was working on the only level of my current project when I realized that the Event Begin Play of my Level Blueprint is ALWAYS fired twice. Couldn’t find any usefull info about that until there.
No “DoOnce” node could do the trick, since the whole graph seems to be duplicated, everything in it will happen twice. This is really annoying.

I really don’t want to export everything in a newly created map… this one has already a lot of work in it… Or is there a way to quickly duplicate it all ?

Any idea on how to solve the problem ? Will I have to never use the Event Begin Play of my Level Blueprint ever more ?

Engine version : 4.19.1

Thanks

I just checked it with 4.20.1.
I made an empty level, put a “print string”-node after the begin play in the level.
In my case the string was printed only once.

Can you post a screenshot of your level blueprint, in particular the BeginPlay event?

Not sure if it helps, but an emergency solution could be to add a “AlreadyPlaying”-boolean with deault value “false” to your levels blueprint. In the levels “Begin Play” event, check if “AlreadyPlaying” is true. If true, do nothing. If false, set it to true and do your stuff that previously was in your “Begin Play” event.
But i guess that’s what the DoOnce-Node is supposed to do anyway, so i don’t know if it’ll work.

Alternatively, you can put logic in GameState (accessible by server and client) or GameMode (only stuff for server). Or if its level-specific stuff, you could put your logic in an otherwise empty actor blueprint and place that invisible actor in the level.

About exporting:
Not sure if it helps, but when you mark all relevant nodes you can copy and paste them (Ctrl+C to copy, Ctrl+V to paste) to another blueprint.

Also on 4.19 the Begin Play is fired only one time and in one level is possible to place only one Begin Play Event, if you can post a screenshot about it :slight_smile:

Hello !

Sorry for the late response, I thought to be specified by email if answers to this thread occurred but apparently not haha.

I have already tried all the ways to make sure that Begin Play is only used once (DoOnce, Boolean check, …) but everything seems to happen as if the thread in question was fully duplicated in different and independent wires, including DoOnce’s mechanics.

Showing you my BeginPlay would not be very productive because it’s nested functions / macros, it would take lots of screenshots for you to view … Anyway I decided, for the moment, to place the mechanics I need in specific actors. Not only does this have the advantage of getting around my problem, but it also improves the reusability of the mechanics in question across the levels.

Concerning the problem itself, a search on the forums seems to indicate that it comes up to random people, and no one seems to have an idea of ​​what to do.

Does it also occur, if you replace your nested macro logic with just a simple “Print” node? Just to be sure that the error REALLY comes from the OnBeginPlay-event firing twice and not from anything the event actually triggers.

Yes, it occurs even with just a Print. More, the Event is fired three times now, without me changing anything since.

Wow, that is extremely puzzling… Did you try reinstalling the engine? Or is it probably project specific? So if you would create a new project and give it a try there, what would happen?
I mean, on the other hand… you can do a workaround with a bool variable like “eventIsFiredTheFirstTime”, which is used at a branch right after the EventBeginPlay and will be set to False after your actual logic…

I have proofs here. I tried to change the LevelScriptActor by code and I had that. What does it mean?

I can top that. My Event Begin Play in my Level Editor fires SIX times! Nothing but Event Begin Play > Print String. And it’s just that one level. I tried the same thing on my other levels and they only print once. I can’t make heads or tails of it.

Sorry to necro this, but hopefully it’s helpful to someone. I had the same issue, Event Begin Play firing 5 or 6 times. I made a work around with some Do Once nodes and it worked well enough in the editor. But when I went to build, I got this error for that map:
Error: Detected the creation of more than one LevelScriptActor
Turns out somehow the map essentially had multiple Level Blueprints. Couldn’t tell you how it happened. I was trying to figure out what to do about it and one day I opened the level and in the bottom right I got this popup that said something like “Multiple Level Script Actors detected”, and there was a button that said “Fix it”. I clicked on it and voila. Don’t know why I never saw it before. This is in 5.1. It may have had something to do with the fact that I had the Output Log open when I loaded the map, but maybe not. I don’t know how I would have fixed it otherwise.