References to device is always invalid (verse code)

Summary

Reference to device is always invalid. Console logs (e.g., it has been destroyed during gameplay or disposed of by verse or 'Register with Structural Grid' was specified for it in UEFN)

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  1. Create these 2 devices in your scene ( quest_device_problematic and some_device_to_reference )
  2. Create a quest
  3. Create a task inside of the quest
  4. Reference the some_device_to_reference

( See image for an example)

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

my_quest_task_problematic<public> := class(quest_task_interface_problematic) {
    @editable
    Device : ?some_device_to_reference = false

    Init<override>():void = {
        if(Dev := Device?) {
            Print("initing device {Dev.SomeIdentifier}")

            spawn { 
                MoveDevice()
            }

            # Broken as well, will never call the callback
            # Dev.OnSomeEvent.Subscribe()

            # If Device changes the data won't be reflected here. Is our reference somehow a copy that's no longer valid??
        }
    }

    MoveDevice()<suspends>:void={
        loop {
            if(Dev := Device?) {
                # Throws errors? Device refernce is somehow broken?
                Dev.MoveTo(Dev.GetTransform().Translation + vector3{X := 100.0, Y := 0.0, Z := 0.0}, IdentityRotation(), 1.0)
            }

            Sleep(1.0)
        }
    }
}

quest_task_interface_problematic<public> := interface {
    Init():void
}

quest_problematic := class(quest_interface_problematic) {
    @editable
    Tasks : []?quest_task_interface_problematic = array{}    

    Init<override>():void = {
        for(Task : Tasks, T := Task?) {
            T.Init()
        }
    }

    GetTasks<override>():[]?quest_task_interface_problematic = Tasks
}

quest_interface_problematic<public> := interface {
    Init():void
    GetTasks():[]?quest_task_interface_problematic
}

quest_device_problematic<public> := class(creative_device) {

    @editable
    Quests : []?quest_interface_problematic = array{}

    OnBegin<override>():void={
        for(Quest : Quests, Q := Quest?) {
            Q.Init()
        }
    }
}


some_device_to_reference<public> := class(creative_device) {

    @editable
    SomeIdentifier<public> : int = 0

}

Expected Result

Device reference should be valid, however, the reference is broken. You’re still able to get data from the device (e.g. the SomeIdentifier) field, but any event signalled by the device will not call the callback.

Observed Result

When trying to move the object this error is logged. Also, any events will not fire.

LogVerse: Warning: Devices_move_to_debug_log: MoveTo error: The object being moved is no longer valid (e.g., it has been destroyed during gameplay or disposed of by verse or ‘Register with Structural Grid’ was specified for it in UEFN)

Note that if I create the reference (see code below) on the quest_device_problematic directly, it works as expected.

@editable
    Device : ?some_device_to_reference = false

Platform(s)

Only windows 11 tested

Upload an image

Additional Notes

Please let me know if you have issues replicating

Hello i have the same problem.

In general, if I define a creative prop in a class and then, in Verse, I call that class to retrieve the creative prop and use a MoveTo, I get the same error message.