Hi guys I hope you are doing fine.
Today I migrated my project from UE5.4 to UE5.5 but I couldn’t compile my project. The error was complaining about not using “TObjectPtr
” so instead of enabling the usage of Raw pointers in the config file, I decided to upgrade my pointers to TObjectPtr
.
My problem is that GetMesh()
function in Character
returns a raw pointer and I wrote a function that returns GetMesh()
so I decided to cast the raw pointer to TObjectPtr
like this:
TObjectPtr <USkeletalMeshComponent> ALyraCharacter::GetSpecifcPawnMesh(bool WantFirstPerson) const{
return WantFirstPerson == true ? Mesh1P : TObjectPtr <USkeletalMeshComponent>(GetMesh());
}
I compiled the project (using UE5.4 and not UE5.5) and everything seems fine. But I am unsure of the method that I used. Any suggestions?