SetDefaultSubobjectClass when calling Super's constructor crashes Unreal Engine

Hello everyone!

Today I started a new project, after creating the base classes a compile step made Unreal Editor crash. Since then my project doesn’t start, at 70% load Unreal Engine stops working. After a bit of fiddling, cleaning the build, deleting some of the folders inside of the intermediate folder, etc. I couldn’t get it to work. No big deal, something got corrupted when it crashed and I can’t get back in, it’s early in the project, I will waste more time trying to solve the problem than starting from scratch.

So I started a new project and when I finished redoing the last class that I managed to do in the previous one the compiler crashed again. Apparently it’s my code that somehow manages to crash the compiler, and I guess when the project begins it rebuilds some things and so it crashes too.

Indeed when I comment everything out except the topmost definition of the class and the GENERATE_BODY() macro the project starts properly.

By uncommenting slowly and recompiling I’ve delimited the problem to the constructor of the class:

http://lpaste.net/2836142406502449152

The three lines inside are not needed to crash the compiler so I’ve left them commented.

The class declaration is as follows

http://lpaste.net/429630822773948416

Hey -

If I understand correctly, the crash is happening with/without the three lines that are currently commented out. If that is the case, then it appears to me that the crash is caused by what is happening in your Super call of the constructor. You can test this by commenting out the call to the Super and attempting to compile again. t appears that the Super is trying to set a movement component that was defined in the parent class, can you load the project through Visual Studio debug mode and confirm that Super::MovementComponentName is valid.

Hello ,
Super::MovementComponentName seems to be valid, to test it I did:

FName test = Super::MovementComponentName;
auto a = test.ToString()

The result is:

Without the auto a = test.ToString() test is invalid tho. I guess the compiler just removes it as it is not being used?

Did you see if the crash occurred with the Super() call commented out? Can you also provide the callstack and log files from the crash as well as the ASpectatorPawn parent class? From what I can tell it appears the parent class has declared a movement component that is being defined through your child class. If having the body of your AArgalisPlayerPawn constructor be empty causes the crash, then the creation/assignment of the movement component seems to be the most likely cause. Since you mentioned copying classes to a new project, can you provide any classes related to your PlayerPawn class and SpectatorPawn class?

Hey -

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Cheers