Why did an unused object cause a crash? C++

I just implemented this class

3

I have not created any instance of the object
I just hit the compile button and the editor crashed.

And… There is nothing on line 34

1

Why did this happened?
Do I need to put a name in the implementation or something like that?

Thank you so much!!


UPDATE


The editor becomes unstable just for the reason of compiling this class. Even if you don’t use it. You can try if you want.

CharacterCapsuleComponent.cpp (3.8 KB)

CharacterCapsuleComponent.h (1.9 KB)

Will the same thing happen if I derive classes from scene components objects?

The issue seem to be inside NewObject function which is asserting the “Outer” parameter and it’s failing (Line 1621 in UObjectGlobals.h). I would try to maybe change the group name for the ClassGroup specifier inside UCLASS as a start. Not sure if that even is the issue but looking at the code where the assertion happens there is something with a name and a pointer to an object causing the issue. Maybe try to add the FObjectInitializer argument to the constructor aswell and pass it to the base constructor?

1 Like

I can’t do that, just compiling the class causes the editor to crash.
I had to delete the class to be able to open the editor.

What happened is not normal right?

It was my first attempt to derive a class from a scene component… now I have a thousand doubts… I don’t know if this only happens with the capsule… or I’ll also have problems if I do it with other components.

Thank you very much for your comment!!

ok i will try that

Yes, you were right. The editor does not crash this way.

UCLASS(ClassGroup=(Start), meta=(BlueprintSpawnableComponent))
class UCharacterCapsuleComponent : public UCapsuleComponent
{
GENERATED_BODY()
public:
UCharacterCapsuleComponent(){};
};

I think I need to learn more about “Class Group”

Now I can do the FObjectInitializer thing.

Thank you very much for your help!!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.