Download

Subobject pointers not compatible?

I have been getting the following error:
“Subobject_Pointers_Must_Be_Compatible”
The problem is that I have no idea of what is ment with that. In addition, the error doesn’t actually refer to any line in my code, so I have litterally no idea about what line is causing the error. Anybody know what could have gone wrong? Thank you in advance!

You’re going to have to provide a few more details. Is this a blueprint only project or a C++ project? When exactly is the error emitted? Have you changed the component types on any actors lately?

Okay sure. It is C++ only. Just as I read this message, I actually mannaged to find and narrow down the components that caused the error:


//Collision Component for when the player Crouches
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Collision)
		TSubobjectPtr < class UCapsuleComponent > CrouchCollisionComponent;

	//Collision Component to check for player headroom
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Collision)
		TSubobjectPtr < class UBoxComponent > UncrouchComponent;

Does this help you?

How and where are you initializing these components? If in code, please paste the relevant snippets.

Okay thanks I found what the problem was. I put “UncrouchComponent = PCIP.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT(“UncrouchComponent”));” instead of “UncrouchComponent = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT(“UncrouchComponent”));”.