Editable references in scene graph prefabs stay unique and are not being overridden in the main level

Summary

When referencing another entity from within the prefab, the reference is not being updated when the prefab is placed into the scene, instead it keeps pointing to an object within the prefab itself. Unless this is undocumented intended behavior, this is a source of bugs.

Additionally this bug report might be related to the following one.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Other

Steps to Reproduce

Add the following test component to your SG project:

using { /UnrealEngine.com/Temporary/SceneGraph }
using { /Verse.org/Simulation }

vz_test_bad_prefab_references_component := class<final_super>(component) {
  @editable
  DebugTitle: string

  @editable
  Entity_Reference_Set_In_Main_Scene: entity

  @editable
  Entity_Reference_Set_In_Prefab: entity

  OnBeginSimulation<override>(): void = {
    Print("----- '{DebugTitle}' Entity_Reference_Set_In_Main_Scene -----")
    Print(ToDiagnostic(Entity_Reference_Set_In_Main_Scene))

    Print("----- '{DebugTitle}' Entity_Reference_Set_In_Prefab -----")
    Print(ToDiagnostic(Entity_Reference_Set_In_Prefab))

    if (Entity_Reference_Set_In_Main_Scene = Entity_Reference_Set_In_Prefab) {
      Print("----- '{DebugTitle}' entity references are equal -----")
    } else {
      Print("----- '{DebugTitle}' entity references are NOT equal -----")
    }

    # Test uniqueness of those entities against other entity component
    if {
      Parent := Entity.GetParent[]
      Components := for:
        Component: Parent.FindDescendantComponents(vz_test_bad_prefab_references_component)
        Component <> Self
      do {
        Component
      }
      OtherComponent := Components[0]
      Print("----- '{DebugTitle}' found other component '{OtherComponent.DebugTitle}' -----")

      if (Entity_Reference_Set_In_Main_Scene = OtherComponent.Entity_Reference_Set_In_Main_Scene) {
        Print("----- '{DebugTitle}' Entity_Reference_Set_In_Main_Scene references with other entity are equal -----")
      } else {
        Print("----- '{DebugTitle}' Entity_Reference_Set_In_Main_Scene references with other entity are NOT equal -----")
      }
    
      if (Entity_Reference_Set_In_Prefab = OtherComponent.Entity_Reference_Set_In_Prefab) {
        Print("----- '{DebugTitle}' Entity_Reference_Set_In_Prefab references with other entity are equal -----")
      } else {
        Print("----- '{DebugTitle}' Entity_Reference_Set_In_Prefab references with other entity are NOT equal -----")
      }
    }
  }
}

Create a prefab with the following structure and the component to it:

Link the target_entity against the editable Entity_Reference_Set_In_Prefab field within the prefab itself.

Place a parent entity, and place two samples of that prefab.
image

Configure each prefab like following:


The Entity_Reference_Set_In_Main_Scene field should be set to the child target_entity entity the prefab generated in the outliner.

Run the simulation.

Here are the logs:

----- '0' Entity_Reference_Set_In_Main_Scene -----
Entity /...-c1ab874f1c0b/vz_experiments_LevelInstance_3.vz_experiments:PersistentLevel.LevelEntity.LevelEntity.Entity.vz_test_bad_prefab_references_C_0.target_entity
----- '0' Entity_Reference_Set_In_Prefab -----
Entity /...-c1ab874f1c0b/experiment_5/vz_test_bad_prefab_references.Default__vz_test_bad_prefab_references_C:target_entity ❌ UNEXPECTED
----- '0' entity references are NOT equal ----- ❌ UNEXPECTED
----- '0' found other component '1' -----
----- '0' Entity_Reference_Set_In_Main_Scene references with other entity are NOT equal ----- ✅ EXPECTED
----- '0' Entity_Reference_Set_In_Prefab references with other entity are equal ----- ❌ UNEXPECTED


----- '1' Entity_Reference_Set_In_Main_Scene -----
Entity /...-c1ab874f1c0b/vz_experiments_LevelInstance_3.vz_experiments:PersistentLevel.LevelEntity.LevelEntity.Entity.vz_test_bad_prefab_references_C_1.target_entity
----- '1' Entity_Reference_Set_In_Prefab -----
Entity /...-c1ab874f1c0b/experiment_5/vz_test_bad_prefab_references.Default__vz_test_bad_prefab_references_C:target_entity ❌ UNEXPECTED
----- '1' entity references are NOT equal ----- ❌ UNEXPECTED
----- '1' found other component '0' -----
----- '1' Entity_Reference_Set_In_Main_Scene references with other entity are NOT equal ----- ✅ EXPECTED
----- '1' Entity_Reference_Set_In_Prefab references with other entity are equal ----- ❌ UNEXPECTED

Expected Result

  • The Entity_Reference_Set_In_Main_Scene and Entity_Reference_Set_In_Prefab should point to the same objects from the scene.
  • Sibling entities should not have Entity_Reference_Set_In_Prefab pointing to the same shared object.

Observed Result

  • Entity_Reference_Set_In_Main_Scene and Entity_Reference_Set_In_Prefab are not pointing to the same object.
  • Sibling entities pointing to the same shared object through Entity_Reference_Set_In_Prefab reference.

Platform(s)

UEFN

Additional notes

When dragging an additional prefab into the scene while the edit session is active, there will be an immediate runtime error as the reference is accessed but not yet set.

Even worse, when clicking on YES, the editor will silently update the prefab and delete the target_entity and trash the reference.

Thank you @Velocity_Zero - we’ll get someone to take a look.

The team is taking a look at this. Thank you for the report!

Hey Flak, it looks like the Scene Graph issue was tackled very fast. In case SG issues have high priority, I opened a few other SG bug reports recently. Should I tag you there, so you can forward them to the SG team?

Edit - here’s the list:

There is no need to tag; the tickets will be updated when the team starts investigating. They are sorted by QA.

This process takes time. Thank you!

1 Like

FORT-870988’s status has changed to ‘Ready for QA’. A member of the QA department is investigating the issue.

This issue will be addressed in 35.00.