What code should be avoided from an object's CD0?


I was wondering, what kind of code should be avoid from the CDO? I’m creating a bunch of delegates in the constructor, and I was wondering if I should avoid doing this for the CDO?

// Should I avoid creating these in the CD0?
OnCreateSessionCompleteDelegate = FOnCreateSessionCompleteDelegate::CreateUObject(...);
// more delegates here...

CD0 = ClassDefaultObject. If I understand this correctly, when you spawn an object in UE4, this will be created first, and then other objects with the same type will be a copy of the CDO?

If you want to work with CDO and constructors you should first learn about Object Flags, such as RF_ClassDefaultObject, and understand why they exist and how they can be used.

Some common mistakes with constructors in Unreal can brick your project to a point where it will never open in Editor again.

I had to spend long nights looking inside engine source code until I understood what Unreal is really doing with constructors…

Thanks for the heads up. I think I’ll just ignore this for now, and not worry about CD0 optimization.