Scene Graph: removing and re-adding entities present at game start doesn't work

Summary

Removing an entity that was present at game start and then trying to add it back to its parent again doesn’t work. In contrast, the same operation works for a dynamically added entity.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  1. Place an entity with a mesh or some other visible component in the editor

  2. Have some code that will remove this entity and add it back again
    e.g. demo device from the video:

using { /Fortnite.com/Devices }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/SpatialMath }

demo_device := class<final>(creative_device) {
	@editable TestButton: button_device = button_device{}

	OnBegin<override>()<suspends>: void ={
		if (SimulationEntity := GetSimulationEntity[]) {
			TestButton.InteractedWithEvent.Await()

			NewEntity := entity{}
			NewEntity.SetGlobalTransform(FromTransform(TestButton.GetTransform()))
			NewEntity.AddComponents(array{sphere_light_component{
				Entity := NewEntity
				ColorFilter := NamedColors.Green
				Intensity := 30.0
			}})
			SimulationEntity.AddEntities(array{NewEntity})
			Print("Added \"dynamically added entity\"") # to notice the behavior difference

			loop {
				TestButton.InteractedWithEvent.Await()
				RemovedEntities := for (Entity:SimulationEntity.GetEntities()) {
					Entity.RemoveFromParent()
					Entity
				}
				Print("Removed {RemovedEntities.Length} entities | Now Present: {SimulationEntity.GetEntities().Length}")

				TestButton.InteractedWithEvent.Await()
				SimulationEntity.AddEntities(RemovedEntities)
				Print("Should have added back {RemovedEntities.Length} entities | Now Present: {SimulationEntity.GetEntities().Length}")
			}
		}
	}
}

Expected Result

Entities present at game start should have the same behavior as dynamically added entities

Observed Result

Entities present at game start don’t show up again after being removed and re-added. The server state indicates it knows about them

Platform(s)

N/A (Desktop)

Video

FORT-920723 has been added to our ‘To Do’ list. Someone’s been assigned this task.