FObjectInitializer in UE5

There are serval posts talking about FObjectInitializer in UE4, but I found out the default template of C++ in UE5 no longer using:AClassName(const FObjectInitializer& ObjectInitializer = ObjectInitializer::Get()) anymore.

I want to know if there is any difference between:

AClassName(const FObjectInitializer& ObjectInitializer = ObjectInitializer::Get())
AClassName(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
=============== VS ===================
AClassName()
AClassName() : Super(ObjectInitializer::Get())

except the first one can accept Parameters from drived class.

Because I saw most of the engine class has default const FObjectInitializer& ObjectInitializer = ObjectInitializer::Get(), so is that means it doesn’t matter?

I can just use CreateDefaultSubobject<>() rather than ObjectInitializer.CreateDefaultSubobject<>()

Technically the ObjectInitializer version of constructor is deprecated. At least that’s what the documentation says, but I don’t think there is an alternative for say DoNotCreateDefaultSubobject so in that case you still need to use the constructor with ObjectInitializer version. You are also forced to use the ObjectInitializer version if any of the parent classes uses it (otherwise code won’t compile).

Thanks for the answer!
I was reading the UE class code and thinking the same way, but I can’t be sure.

Looks like whatever the parameters are, the engine handles the FObjectInitializer, and the only 2 reasons for adding it are either for:

  1. Correct C++ syntax to compile.
  2. Access the DoNotCreateDefaultSubobject or CreateDefaultSubobjectClass function.

But looks like some UE plugins/classes that override the default UObject constructor require manually adding it to the derived class constructor.