How to get character mesh in C++ from Character Blueprint?

I think you making a confusion between blueprint and C++.
I guess you wanted to access a mesh component set in your BP from your C++ class (also set in the same BP).

You can implement this function in your class to get the Character Mesh.

USkeletalMeshComponent* ACastable::getCharacterMesh()
{
	USkeletalMeshComponent* mesh = NULL;
	AActor *characterActor = NULL;

	characterActor = this->GetParentActor();
	if (characterActor != NULL)
	{
		mesh = Cast<USkeletalMeshComponent>(characterActor->GetComponentByClass(USkeletalMeshComponent::StaticClass()));
	}
	return (mesh);
}

I know this is an old thread but this could help some people who are looking for the same answer.

3 Likes