Session crashes when storing the transform component in a variable and accessing the GlobalTransform from an entity

Summary

I’m using SceneGraph in my project, and specifically when I create a local GlobalTransform variable, from a TransformComponent, a freeze happens, and I’m disconnected from the session.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  • Create an entity
  • Add the components: interactable_component, mesh_component
  • Attach the script below
  • Start the session and interact with the Entity

Script:

crash_control_npc_component<public> := class<final_super>(component):
    var MaybeNpcInteractableComponent : ?interactable_component = false
    var MaybeGlobalTransform : ?transform_component = false

    OnBeginSimulation<override>():void=
        if(InteractableComponent := Entity.GetComponent[interactable_component]):
            set MaybeNpcInteractableComponent = option{InteractableComponent}
            InteractableComponent.SucceededEvent.Subscribe(OnSucess)
        if(TransformComponent := Entity.GetComponent[transform_component]):
            set MaybeGlobalTransform = option{TransformComponent}

    OnSucess(Agent:agent):void=
        if:
            EntityTransform := MaybeGlobalTransform?
        then:
            GTranslation := EntityTransform.GlobalTransform.Translation

Expected Result

Continue as normal, without closing the session.

Observed Result

The player freezes, and the session crashes after a few seconds.

Platform(s)

PC

Additional Notes

Just trying to write the line “EntityTransform.GlobalTransform.Translation” will not crash, only when creating a variable with it.

I managed to make it work normally by accessing the transform class store in an optional variable in OnBeginSimulation:

crash_control_npc_component<public> := class<final_super>(component):
    var MaybeNpcInteractableComponent : ?interactable_component = false
    var MaybeGlobalTransform : ?(/Verse.org/SpatialMath:)transform = false

    OnBeginSimulation<override>():void=
        if(InteractableComponent := Entity.GetComponent[interactable_component]):
            set MaybeNpcInteractableComponent = option{InteractableComponent}
            InteractableComponent.SucceededEvent.Subscribe(OnSucess)
        if(GlobalTransform := (Entity.GetComponent[transform_component]).GlobalTransform):
            set MaybeGlobalTransform = option{GlobalTransform}

    OnSucess(Agent:agent):void=
        if:
            EntityTransform := MaybeGlobalTransform?
        then:
            GTranslation := EntityTransform.Translation