Summary
When using Entity.RemoveFromParent() on an entity that is a child of a prefab, the removal isn’t happening within the game, but server state seems correct.
Please select what you are reporting on:
Unreal Editor for Fortnite
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
- Create a custom component that removes its entity after some time
example_component := class<final_super>(component) {
OnSimulate<override>()<suspends>: void ={
Sleep(5.0)
if (Parent := Entity.GetParent[]) {
Print("Initial parent child count: {Parent.GetEntities().Length}")
Entity.RemoveFromParent()
Print("RemoveFromParent called, new parent child count: {Parent.GetEntities().Length}")
}
}
}
-
Create a prefab containing a child entity with the custom component. Give it a mesh too
-
Spawn the prefab to the world
using { /Fortnite.com/Devices }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
example_device := class<final>(creative_device) {
@editable TestButton: button_device = button_device{}
OnBegin<override>()<suspends>: void ={
TestButton.InteractedWithEvent.Await()
NewEntity := Prefab_example{}
NewEntity.SetGlobalTransform(FromTransform(TestButton.GetTransform()))
if (SimulationEntity := GetSimulationEntity[]) {
SimulationEntity.AddEntities(array{NewEntity})
}
}
}
Expected Result
The child entity removal should be replicated to players.
Observed Result
The entity is still visible to players after being removed. The server state seems correct: Parent.GetEntities().Length decreases, and the player can glitch through the mesh when walking into it.
Platform(s)
N/A (Desktop)