Custom movement component is always null

Branch: Binary
Build: 4.2

Detailed information:

When adding a custom movement component, the component is always null after being returned from SpawnActor. The component itself is loaded and initialised, but the reference is lost when passing back up the constructor call stack.

More detail + debugging here - Adding custom movement component - C++ - Unreal Engine Forums

Steps to reproduce:

Create an empty project from the c++ shooter
Create a new c++ file that subclasses CharacterMovementComponent

Change the Character.cpp file to use the new movement component (example here - A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums)

Build + Run the game, start playing and then try and move. You cant because the component has been NULLed


Thank you for your report. We were not able to investigate this on the engine version you reported, but there have been many version changes to UE4 since this question was first posted. With a new version of the Engine comes new fixes and it is possible that this issue has changed or may no longer occur. Due to timetable of when this issue was first posted, we are marking this post as resolved for tracking purposes.

If you are still experiencing the issue you reported in the current engine version, then please respond to this message with additional information and we will investigate as soon as possible. If you are experiencing a similar, but different issue at this time, please submit a new report for it.

Thank you

Its still happening in 4.20.
I successfully added C++ custom class, shown in editor, spawned correctly ingame, but blueprints try use GetMovementComponent() node get None as return.

This is also happening for me in 4.22.2 and I set it up just like 's tutorial:

I think you’ll need to report this as a new bug. This one is marked as answered so they probably won’t look at it again

Parenting the BP to Actor and then re-parenting to Character subclass worked for me.

Ive been trying to fix an issue when trying to convert from UE 4.27 to UE 5.0 for a while now and got it to show me that my character movement kept returning NULL.

The technique of parenting my custom character base class to Actor then back to Character seemed to have fixed the issue of the CharacterMovement component being null (i think it broke other things) BUT finally after weeks of trying to figure this out, progress!

1 Like