UGameInstance::PlayReplay does not work

UGameInstance::PlayReplay does not work. If I call “demoplay ReplayName” through the console, then the playback works.
After studying, I noticed that when UGameInstance::PlayReplay is called in UWorld::SetActiveLevelCollection variable DemoNetDriver sets not nullptr. A call through the console DemoNetDriver sets in nullptr.
If at that moment DemoNetDriver set to nullptr, playback of UGameInstance::PlayReplay is running correctly

How correctly to call UGameInstance::PlayReplay?

A lot of people have the same problem, and seems that in the next hotfix this issue will be solved:

Temporary solution.
It is enough to do the following


virtual void PlayReplay(const FString& InName, UWorld* WorldOverride = nullptr, const TArray<FString>& AdditionalOptions = TArray<FString>()) override;
void HandlePreLoadMap(const FString& MapName);
FDelegateHandle _HandlePreLoadMap;


void UMyGameInstance::PlayReplay(const FString& InName, UWorld* WorldOverride, const TArray<FString>& AdditionalOptions)
    Super::PlayReplay(InName, WorldOverride, AdditionalOptions);
    _HandlePreLoadMap = FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UMyGameInstance::HandlePreLoadMap);
void UMyGameInstance::HandlePreLoadMap(const FString& MapName)
    GetWorld()->DemoNetDriver = nullptr; // The solution lies in this line

Yes, it really helps (in 16.2 also), thx!

I can confirm that this also fixes the “DemoNetDriver out of date” issue with replaying in 4.19 from a custom GameInstance class.