Access device components in verse script

Hi,

I’m trying to spawn given meshes and have them move towards an endpoint. I have the spawning and moving logic working but I wanted to define the startpoint and endpoint by adding simple cube staticmeshes onto the device and using their translation as the points I need.

Is there a way to access the device/actor components, for example a static mesh, from inside the verse script?

I know I can make an @editable field and just add a staticmesh to that so I can use the object in verse scripting but I prefer using the “cleaner” method of having everything I need already on the device.

Thanks!

It’s impossible to reference props without an editable configuration. Also a small nit, it’s props not static meshes that you can link and move around with a Verse script.

What is “cleaner” by your imagination, I’m curious?!

You can’t access your device children if that’s what you’re looking for.

In UEFN, you’ll have to use the @editable specifier as you said, but you’ll need to find what kind of asset you want to use…

You said you already made the moving system, but maybe using a sequencer could be an alternative for you ?

If you want another way to do so, you could use Verse gameplay tags and retrieve your objects like this :

GetCreativeObjectsWithTag<native><public>(Tag:tag)<transacts>:[]creative_object_interface

Also, I just noticed that you can add those tags to static meshes :slight_smile:

EDIT: I can’t guarantee that your objects will be returned in the good order, you could compare distances from origin point maybe ? (which makes this solution less clean actually :thinking:)

1 Like

Well a “clean” solution in my mind is simply when all the necessary components are all encapsulated in the same object. So in my example that would be when I drag my “ObjectSpawner” device in the scene in UEFN, I would see my start- and endpoint as meshes I can position where I want them. Instead now I have my device and 2 completely seperate meshes that I link through an @editable field to my device.

I’ve also tried tags @im_a_lama, but I couldn’t get it to work. I couldn’t even print the position of the mesh I gave a tag. The documentation code for this didn’t work. When I have some more time I’ll play around some more with it.

Anyhow, thanks for the responses!