Event Begin Play of Level Blueprint fires twice

i think it may happen when you update a projects to a new version. If you make a blank projects whit the last version probably will works fine. if that’s the case so it’s a bug…

i had the same problem…begin play of thirdPersonChracterBP executing twice…then i figure out that i accidentally put a thirdPersonChracterBP ref. inside the map…and that was causing this problem…

The problem appeared on the same level engine version.

4.21 the same

I have the same problem with 4.21

I’ve developed a Solution for my game The Missing Few.

1 Like

hi. finally I figured out the reason. it related to using undo in project. it happened to me when Undo my blueprint and every time I undo my level blueprint eventbeginplay fired one time more than before.at first two time then three and four and…
I made a new level and I did not use Undo in my new level any more then the problem solved. and eventbeginplay fired only one time.

2 Likes

Still a problem in 4.25 unfortunately, seems it is to do with when you undo while editing the level blueprint that it duplicates the blueprint or something… Also the project that I’m using has never been upgraded from a previous version so that rules out that possiblity.

This issue still exists in UE 4.26.2, 3 years later… This is the second time in our project that a level BP got corrupted and had to be remade from scratch. Thanks @CGArc for his findings.

1 Like

Same issue here, in 4.26.2 and I’m getting beginplay called twice in my game state

1 Like

4.27 same thing just happened, how is it possible that such serious bug is still not fixed

1 Like

Since this is the top search result, I’ll post what worked for me.

If your level is small and you can manually copy over actors and code to a new level (NOT duplicated), then please do that instead. If you’d like to work with the same level, see below. However, it does still require copying over code, so roll up those sleeves:

  1. Make sure you have source control set up so you can revert the following steps.

  2. Duplicate the problem level and attempt to save it. Unreal will throw up some error popup, stating some chain of references. Cancel it.

  3. You’ll notice that the new duplicated level is created anyway, along with a blueprint file for the original level. This file is important. Duplicate this file and attempt to save it with a new name (something like “<problem_level>_TEMP_BP”), Unreal will throw up error popup as before, but the new level blueprint will indeed get created.

  4. Repeat step 1. At this point, you should have a bunch of useless duplicated levels (delete them) and 2 level blueprints, one original and one TEMP.

  5. Delete the original blueprint. It may not disappear, but if you open it, it will now be cleaned and empty. If you put in the Print node on BeginPlay, you’ll see it executes only once. Whatever nasty duplicate existed in the background is now gone.

  6. Copy over code from the TEMP level blueprint. Unreal may give you option of auto-generating some missing functions, but you’ll have to do rest of the work yourself. Once done, test out your now clean level, delete the TEMP blueprint, save and exit Unreal.

  7. When you reopen the project, the original level blueprint will no longer be visible, as always. Try your level again, just to be sure it works.

Wish Unreal would look into this, but for now, I hope this saves you some hair-pulling!

3 Likes

Where to find the file for the level blueprint? There is none in the explorer nor content browser

It should be in the Content Browser. If you’ve created the project from a template, the levels are usually in a nested folder. In any case, try clicking on the main “Content” folder and search for the name of your level via the search box.

image

Then right-click the level → “Show In Folder View”.

There is indeed apparently a way to get 2 levelScriptActor in a level, I read some people saying when doing some “undo” or creating some Actor ref in the level blueprint, just theories, but anyway, this happened to me too.

When looking to debug in the blueprint of the level (debug filter in blueprint window), I realized there were 2 instances of this blueprint, doing bad behavior in my logic of course (since it calls any event twice).

I use the source code in debug and I notice the level has a pointer to one LevelScriptActor although when I started the level (putting a breakpoint in the constructor ALevelScriptActor::ALevelScriptActor) there were 2 LevelScriptActors that were created with the level name (LeveNameLC_2 and levelNameC_5), but they are meant to be invisible for the user when searching list of the actors in the level.

By forcing those actors to become editable during the breakpoint, they can both appeared in the list of the actors in the level (in the editor windows).

#if WITH_EDITORONLY_DATA
bActorLabelEditable = false;
bEditable = false;
#endif // WITH_EDITORONLY_DATA

From there, I just do fake changes in the blueprint to see which one change name in the Debug Filter of the blueprint and I deleted the one that was not used/changed.

I know this will not help people without the source code, but I passed an afternoon to understand what’s going on, so if it can help someone.

Mate, thank you. I have been chasing this for days 3xBeginPlay firing. AHHHH! Your comment made me realise there were 2 thirdPlayerCharacters in the map! I used them like props! Deleted, then BOOM! Fixed. Thank you soooo much.

1 Like