# 4.7.1 Begin Play called multiple times

**URL:** <https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859>\
**Category:** UI\
**Tags:** cooked, UE4-7, unreal-engine, bug-report, question, Blueprint, UMG\
**Created:** [March 3, 2015, 6:54am UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859 "2015-03-03T06:54:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![riandrake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@riandrake](https://forums.unrealengine.com/u/riandrake)\
**Post date:** [March 3, 2015, 6:54am UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/1 "2015-03-03T06:54:53Z")

</div>

When I run a cooked version of my project (DebugGame or packaged), I’ve noticed that my widgets don’t destroy themselves properly. When I go between levels, sometimes widget persists and is still present despite destroying it on EndPlay.

After adding a Print node in my BeginPlay event, I noticed that HUD blueprint would sometimes fire BeginPlay event twice. This must be causing widget to stop destroying correctly, most likely overwriting first widget created with another widget created on second event call.

I could probably just use a DoOnce node, but I don’t really feel like adding a DoOnce every time I want to make a new HUD. I saw a suggestion somewhere that UE4 sometimes duplicates blueprints when you rename/move them, and I found some duplicates; but they weren’t duplicates of blueprint in question and it didn’t solve issue.

Any ideas?

---

<div class="post-metadata">

**Author:** ![riandrake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@riandrake](https://forums.unrealengine.com/u/riandrake)\
**Post date:** [March 3, 2015, 6:55am UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/2 "2015-03-03T06:55:45Z")

</div>

I should add that this never happens in-editor, just to be clear. Only happens in cooked builds.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [March 3, 2015, 4:16pm UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/3 "2015-03-03T16:16:14Z")

</div>

Hi riandrake,

I haven’t been able to reproduce this yet. Where are you creating widget? Can you reproduce this in a new project, or only your current project? If you can put together a small test project with which this occurs and upload it somewhere, I can take a look to see what might be causing this. Otherwise, a detailed step-by-step guide to reproducing it would be very helpful. Thanks!

---

<div class="post-metadata">

**Author:** ![Lostra01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lostra01](https://forums.unrealengine.com/u/Lostra01)\
**Post date:** [March 3, 2015, 4:20pm UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/4 "2015-03-03T16:20:20Z")

</div>

When you go between levels, make sure you destroy widget first, and load next level only after that.

---

<div class="post-metadata">

**Author:** ![riandrake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@riandrake](https://forums.unrealengine.com/u/riandrake)\
**Post date:** [March 4, 2015, 9:42am UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/5 "2015-03-04T09:42:17Z")

</div>

I’m trying to log all my BeginPlay calls to UE4\_LOG but it’s being inconsistent, I’ll keep trying.

I got this once though:

```
[2015.03.04-09.36.03:298][38]LogTemp:Warning: ATownHUD::BeginPlay
[2015.03.04-09.36.03:299][38]LogTemp:Warning: AHUDBase::BeginPlay
[2015.03.04-09.36.03:343][38]LogTemp:Warning: AHUDBase::BeginPlay

```

Will post again when I find something else useful.

---

<div class="post-metadata">

**Author:** ![riandrake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@riandrake](https://forums.unrealengine.com/u/riandrake)\
**Post date:** [March 4, 2015, 9:22pm UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/6 "2015-03-04T21:22:24Z")

</div>

I fixed my problem! What was happening was I was calling OpenLevel multiple times. way this happened was that I couldn’t call OpenLevel straight away, because I wanted to render a loading screen first. To do this, I had to defer call to OpenLevel until end of next ReceiveDrawHUD call.

My mistake was that I assumed that OpenLevel would only be called once, as I thought it would almost immediately destroy level and load up a new one.

**In short:** Adding a DoOnce node after IsTeleportTriggered branch at end of my ReceiveDrawHUD event _before_ calling OpenLevel fixed it.

---

<div class="post-metadata">

**Author:** ![Pelangi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pelangi](https://forums.unrealengine.com/u/Pelangi)\
**Post date:** [September 3, 2016, 8:11am UTC](https://forums.unrealengine.com/t/4-7-1-begin-play-called-multiple-times/308859/7 "2016-09-03T08:11:08Z")

</div>

Is it true that a function call to `OpenLevel` will trigger event `BeginPlay` within level’s blueprint?
