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 ?