PipeRift / SaveExtension

Provides UE4 with a save-game system with support for savegame tags, level streaming and more
Apache License 2.0
164 stars 60 forks source link

Movable actors reset to (0, 0, 0) on load if its level has never been set visible #72

Open rtorrisi opened 3 years ago

rtorrisi commented 3 years ago

Saving actors in a level that has never been set to visible, result in a reset of Transform to (0, 0, 0) when loading back and set the level visible.

Steps to reproduce the behavior:

  1. Create a persistent level A
  2. Create a sublevel B
  3. Add a movable actor to be serialized in B
  4. Stream in B but set it not visible.
  5. Save
  6. Load, stream B and set it visible.
  7. Actor tranform is reset to 0,0,0

    • Engine Version: 4.26.2
    • Plugin Version: 1.4
    • OS: Windows 10

Possible solution (already tested):

Replace this line

https://github.com/PipeRift/SaveExtension/blob/390033bc757f2b694c497e22c324dcac539bcd15/Source/SaveExtension/Private/Serialization/MTTask_SerializeActors.cpp#L79

(this implementation doesn't work due to world (used in GetTransform) beeing not valid if the level has never been streamed in.)

with

Record.Transform = Actor->GetRootComponent()->GetRelativeTransform();