Description

See https://github.com/EpicGames/UnrealEngine/pull/6722 (shelved in CL 11616092)

DemoNetDriver's scrubbing fails to properly set mobility of components on an Actor in certain cases.

Create a project with multiplayer or server/client logic (make sure it has something with replication to make use of GameInstance Replay functions. Shootergame may be a good example).
Implement (or in the case of Shootergame project make use of) replay logic from GameInstnace.
Have an actor with at least one staticmesh component's root set to static with logic to make root component set to moveable at runtime and move said actor at runtime.
Create a recording of user moving said object by some means.
Play back recording and scrub backwards to some earlier time in the recording.

When scrubbing actors get destroyed and recreated, during this recreation process any actor's components that initially had it's mobility set to "Moveable" via runtime will respawn back in with mobility set to "Static" (if that is what its default class was set as) and will not be able to be moved, causing it to have its location put into an incorrect spot as well. Initially discovered while moving UDATASMITH's actors while recording a demo. By default the actors root is set to static but changing it to moveable at runtime and scrubbing revealed the issue.

I expect all component properties especially the Mobility property (and other generic properties) to be remembered correctly for what it was at that moment in the recording regardless of what the class defaults are for the actor/root component.

In conclusion, when recording actors that have their root components mobility set to static by default in the class, even if their mobility is changed at runtime, scrubbing back through the replay of the recording would set the root component's mobility to class defaults and not to what it actually was at that time during the recording.

The fix proposed here remembers the root component as it was at that time in the recording. That way when a scrub occurs and the actor is destroyed and respawned, the spawning method now looks to see if a TemplateRootComponent (TRC) exists and applies the TRC's mobility to the new spawned actors root component. The end result makes for a smooth and clean scrub forwards or backwards. Previously it would apply default mobility and if that was static mobility would not allow you to move the root component making it look frozen and not be in the correct position during a scrub. The could potentially be expanded to include other properties if need be but to not assume further problems exist I only added what I've been able to notice. Admittedly there may be a better way to do this then my proposed solution.

Modified Files:

//UE4/Main/Engine/Source/Runtime/Engine/Classes/Engine/DemoNetDriver.h (edit)
//UE4/Main/Engine/Source/Runtime/Engine/Classes/Engine/World.h (edit)
//UE4/Main/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp (edit)
//UE4/Main/Engine/Source/Runtime/Engine/Private/LevelActor.cpp (edit)

The support team will close the pull request when this ticket is marked fixed. Please include a #6722 tag somewhere in the description of any p4 changelists related to this pull request, so that GitHub can cross-reference it.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-89507 in the post.

3
Login to Vote

Won't Fix
ComponentNetworking
Target Fix4.26
CreatedFeb 25, 2020
ResolvedAug 11, 2020
UpdatedAug 27, 2021