[SCENE GRAPH VERSE] Mesh entered and exited event doesn't work with a var mesh_component unless looped

Summary

When a var mesh_comonent is used for EntityEnteredEvent and EntityExitedEvent, these events stop getting called when the var mesh_component is changed unless the events are looped however, when these are looped, the event gets called too much and logic is broken

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

Create this setup:

if. var Mesh : mesh_component = E.GetComponent[mesh_component] then:
    Mesh.EntityEnteredEvent.Subscribe(Function1)
    Mesh.EntityExitedEvent.Subscribe(Function2)

    NewEntity := entity{}
    MeshComp := NEWMESH:
         Entity := NewEntity, Material := AMaterial
    set CompArray = array {MeshComp}

    ChildEntities : []component = E.GetComponents()
    for (Index := 0..ChildEntities.Length -1):
         if. Child := ChildEntities[Index]
         then. Child.RemoveFromEntity()

     E.AddComponents(CompArray)

    SpawnedMeshComp := E.FindDescendantComponents(mesh_component)
    for (MeshComponent : SpawnedMeshComp):
        set SpawnedMesh = MeshComponent

Expected Result

The subscribable EntityEnteredEvent and EntityExitedEvent events continue to fire even after the mesh is changed from its original

Observed Result

The events are not fired after the mesh is changed

Platform(s)

Any

Additional Notes

looping the events does get them to update but this can’t be used as the event ends up being fired too many times

Wouldn’t it then be a new mesh though ? i dnt understand your thinking in this.

I personally use Awaits() on the mesh_component so i dnt think i would have this issue

Forgot to include the part where i set the var, sorry

SpawnedMeshComp := E.FindDescendantComponents(mesh_component)
for (MeshComponent : SpawnedMeshComp):
    set SpawnedMesh = MeshComponent

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