# \[UE 4.5 C++\] Actor bug

**URL:** <https://forums.unrealengine.com/t/ue-4-5-c-actor-bug/298735>\
**Category:** C++\
**Tags:** bug, aactor, UE4-5, unreal-engine, CPP, question\
**Created:** [November 11, 2014, 1:17pm UTC](https://forums.unrealengine.com/t/ue-4-5-c-actor-bug/298735 "2014-11-11T13:17:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamesenin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamesenin](https://forums.unrealengine.com/u/kamesenin)\
**Post date:** [November 11, 2014, 1:17pm UTC](https://forums.unrealengine.com/t/ue-4-5-c-actor-bug/298735/1 "2014-11-11T13:17:04Z")

</div>

Hi!  
I have huge problem with 4.5 version of Unreal Engine. First I will write steps how to reproduce it.

I am creating new project base on First Person C++ template in version **4.4 and 4.5**. In editor I am adding by “Add code to Project” new Actor class “MyTestActor”.  
C++ is simple as this:

```
MyActorTest.h
#pragma once

#include "GameFramework/Actor.h"
#include "MyActorTest.generated.h"

/**
 * 
 */
UCLASS()
class ACTORTESTPRJ_API AMyActorTest : public AActor
{
	GENERATED_UCLASS_BODY()

	bool bFail = false;

	virtual void BeginPlay();
	virtual void OnConstruction(const FTransform& Transform);
	
};

```

and

```
MyActorTest.cpp
#include "TestActorPrj.h"
#include "MyActorTest.h"

AMyActorTest::AMyActorTest(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

}

void AMyActorTest::OnConstruction(const FTransform& Transform)
{
	bFail = true;
	UE_LOG(LogTemp, Warning, TEXT("Name: %s ,%d"), *this->GetName(), bFail);
}

void AMyActorTest::BeginPlay()
{
	UE_LOG(LogTemp, Warning, TEXT("Name: %s ,%d"), *this->GetName(), bFail);
}

```

After launching Editor I am adding MyTestActor on the scene. Click ‘Save’, closing Editor (for proper logging), running my project again from VS and hitting Play

Now the difference between 4.4 and 4.5

**4.4**

- OnConstruction is called **twice**
- my bFail boolean = **true**

**4.5**

- OnConstruction is called **three times**
- my bFail bool = **false**

Why my bool has been ‘reset’ to default value ? It does not make sens and this is the simplest example with what I have problem. Any ideas ?

---

<div class="post-metadata">

**Author:** ![Omberone](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omberone](https://forums.unrealengine.com/u/Omberone)\
**Post date:** [November 11, 2014, 2:36pm UTC](https://forums.unrealengine.com/t/ue-4-5-c-actor-bug/298735/2 "2014-11-11T14:36:14Z")

</div>

Are you sure you only have one actor in the scene?

---

<div class="post-metadata">

**Author:** ![kamesenin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamesenin](https://forums.unrealengine.com/u/kamesenin)\
**Post date:** [November 11, 2014, 2:48pm UTC](https://forums.unrealengine.com/t/ue-4-5-c-actor-bug/298735/3 "2014-11-11T14:48:16Z")

</div>

Yes. You can check it out by reproducing my steps above

---

<div class="post-metadata">

**Author:** ![Jonathan\_Dorman\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jonathan\_Dorman\_1](https://forums.unrealengine.com/u/Jonathan_Dorman_1)\
**Post date:** [December 3, 2014, 3:44pm UTC](https://forums.unrealengine.com/t/ue-4-5-c-actor-bug/298735/4 "2014-12-03T15:44:02Z")

</div>

Hello kamesenin,

I’m marking this question as Resolved because it’s been answered in your other thread.

Thanks,

Jonathan
