BeginPlay() for UObject

I have a custom object which needs to be automatically initialised before it’s owning Actor invokes BeginPlay(), Here’s what I’ve tried so far based on this question:

MyActor:

AMyActor::AMyActor() {
    MyObj = CreateDefaultSubobject<UMyObject>(TEXT("MyObj"));
}

void AMyActor::BeginPlay() {
    Super::BeginPlay();

    if (MyObj) {
        MyObj->DoSomething();
    } 

MyObject:

void UMyObject::DoSomething() {
    if (ActorOwner) {
      // ... Do something with ActorOwner
    }
}

void UMyObject::PostLoad() {
    Super::PostLoad();

    if (GIsEditor && !GIsPlayInEditorWorld) {
        return;
    }

    Init(GetOuter());  // ActorOwner = Cast<AActor>(GetOuter());
}

My main goal here is to avoid having to use MyObj->Init(this) inside the MyActor and instead the let object initialise itself since it becomes tedious when there are several custom objects

Am I doing this right or is there a better way?

No, there’s no particularly good hook for this with UObjects. Init functions are the most common practice.

One alternative would be for your object to be a UActorComponent instead of UObject. Those do include additional hooks into the Actor lifetime so that you could do things prior to BeginPlay.

you can use
virtual void PostInitProperties() override;

but its not a great solution

I tried that but it doesn’t work as intended

When I store the GetOuter() in PostInitProperties() and then use it in DoSomething() it shows as null value for some reason

void UMyObject::PostInitProperties() {
    Super::PostInitProperties();

    if (GIsEditor && !GIsPlayInEditorWorld) {
        return;
    }

    Init(GetOuter());  // ActorOwner = Cast<AActor>(GetOuter());
}

void UMyObject::DoSomething() {
    ActorOwner // This is null/invalid for some reason
}

I have several UObjects and I don’t think it would make sense for them to be UActorComponent

Is there really no other way?

whats the problem with all the custom objects having a parent class with an overridable Init()?

There’s no problem with it
The problem is the need to repeatedly call Init() instead of it being taken care of internally

just wrap it in a static

I don’t follow what do you mean by wrapping it in static?

i mean create a static function that creates and initializes your Object,