[BUG, Unsolved, Workaround.] UE 5.1 Constructor created component invalid on BeginPlay

Roy Wierer (Seda145)
Wed, 01 Feb 2023 13:43:02 +0000
Issues and Bug Reporting

Using the following setup the UActorComponent is always invalid on BeginPlay of the character. The component is correctly visible in the blueprint editor and there are no compilation errors c++ or BP side. What is this about? Any reason it would somehow be deleted by the engine?

protected:

	UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
		UPawnCameraManagerComponent* ACPawnCameraManager = nullptr;

ACharacterALS::ACharacterALS() {
	ACPawnCameraManager = CreateDefaultSubobject<UPawnCameraManagerComponent>(TEXT("PawnCameraManagerComponent"));
}

Related and unsolved:

Missing Components Created Through C++ Constructor - #5 by tailedmouse

When creating a SkeletalMeshComponent in Actor Constructor, why is it null in BeginPlay?

Component pointer invalid after creation in class constructor

How to create a custom UActorComponent properly?

Initialized components are null during gameplay

Actor component is null in BeginPlay, Tick

12 posts - 6 participants