GetCharacterMovement() returns nullptr

NedimH
Fri, 12 Jun 2020 12:10:42 +0000
C++

Hello,
I am experiencing a bizarre problem, where GetCharacterMovement() returns a nullptr when called from BeginPlay().
I have a big inheritance tree for my character class:

ACharacter ->AMICharacter->ABaseCharacter->AHumanCharacter.

The character movement component class is changed in AMICharacter via the ObjectInitializer.
It is worth noting that the first custom character movement class has been replaced by a second one. Several blueprints that inherit from AHumanCharacter were created before that replacement, and, as a result, the assets have been corrupted. This was fixed by a simple core class redirect.

Now, the character movement component is clearly present in every instance of my blueprint(s), including placed instances, spawned instances or the instance present in the blueprint editor. Furthermore, the constructor of AHumanCharacter calls GetCharacterMovement(), which does NOT return a nullptr at that point. However, the same function, in the same class, returns a nullptr when called from BeginPlay(). Does anyone have any idea what’s going on and how I can fix this?

3 posts - 3 participants