UE5.4.3, No viable operator= matches arguments of type TObjectPtr<class ABaseCharacter> and const ABaseCharacter*.

Hello everyone I need help.

In UE 5.4.3 and Rider 2024.2.1,
I have a Class BaseCharacter from a Class ACharacter
rider64_8T0vXyKXi6

I Have an animation instance where I point to that class
rider64_8cF4thDgGf

But then in the cpp I’m not able to assign a character to the class.
rider64_TiqnATaeki

With the following error

I believe this was working before, but now I’m unable to compile

Any suggestion?

The “TryGetPawnOwner” seems to return a const pointer.

Either you can modify the function TryGetPawOwner to return a non-const pointer, or you may try to do “const_cast<ABaseCharacter*>(TryGetPawnOwner())”, though the latter option is not particularly nice code.

You can also just change your declaration to be TObjectPtr<const ABaseCharacter> Character;, if you’re not planning to modify it

1 Like