How to use GetWorld() from UOBJECT correctly?

Hello,

I need to get GetWorld() from my UOBJECT to obtain a TimerManager.

I found a good answer what explains why it is impossible to obtain GetWorld() directly for UOBJECT:

A UObject does not know inherently
what world it belongs to. The purpose
of the GetWorld function is for that
Object to be able to let others know
which World it is in. Actors do this
via their Level reference and
Components do this either via their
Actor owner or the World they’ve been
registered with. Each other Object
type has to find its own path back to
World, often through a reference to an
Actor.

If you want to be able to call
GetWorld on your class, you need to
override the function and provide a
valid path to a World.

Ok, I used this code six months ago, but now it does not work and I don’t know why)

in UObject class:

// in .h

virtual class UWorld* GetWorld() const override;

...

// in .cpp

#include "ClientCharacter.h"
...
class UWorld* UDifferentVariables::GetWorld() const
{
	AClientCharacter* CharacterInstance = Cast<AClientCharacter>(GetOuter());

	if (CharacterInstance) return CharacterInstance->GetWorld();
	else return nullptr;
}

void UDifferentVariables::StopWaitingScreen()
{
        // NULL !!
	GetWorld()->GetTimerManager().ClearTimer(TimerHandle);
	ProgressPercent = 0.f;
}

GetWorld() always return NULL, what am I doing wrong?

Thanks!

I found a solution. My problem is in understanding GetOuter().
This question help me very much:

An object’s “Outer” is the object which “owns” it. Respectively I need some changes in ClientCharacter:

// in ClientCharacter.h

    // My UOBJECT
	UPROPERTY()
	UDifferentVariables* WaitingScreen = nullptr;

// in ClientCharacter.cpp

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

	if (GEngine)
	{
		WaitingScreen = NewObject<UDifferentVariables>(this, UDifferentVariables::StaticClass());

	}	
}

After that, he began to work.