I’m trying to implement FindCreativeObjectsWithTag because of the deprecation of GetCreativeObjectsWithTag, and I don’t really understand why it has to be tied to a creative_device. The function’s signature looks like this:
This way, only instances of creative_device can look for objects by tag, but I was hoping to use it in a module where my code is more functional, not so object-oriented. With GetCreativeObjectsWithTag deprecated, I expected to update my code easily, but now I would need to refactor some things. The fastest solution would be to pass down a parameter with the calling device, but it feels like a dirty workaround (prop drilling comes to my mind).
Is there a reason for needing creative_device here? Would be great if we could use the function without it.
Apparently, it would be because of the future structure of Verse, the previous method being a global method, which means it could be accessed from everywhere (across all game sessions and map levels if I understand correctly)
To me, it would mean that they had two choices upon fetching tagged devices :
It should fetch devices from the current level, which means that there’s an unexposed level class that would need to be the method holder instead of the creative_device, but this is what they use to know which level to fetch tagged devices from
It should fetch devices across levels in the current session, which means that there is an unexposed session class, even though we have an empty session class already, it seems to be needing a rework, I’m also confused here because fort_playspace seems to do the trick, but maybe it needs a rework too
The first answer seems to make more sense, it’s only speculation though
This is a really good example that I’m thinking Epic didn’t think about, well you need to find a way to access any placed creative_device globally from the behavior since you can’t choose a device reference from npc_behaviors, any creative_device editable will construct a new one which cannot be used to fetch tagged devices
If you don’t know how to use tags, then you don’t need tags … but to understand them watch the video. The code is essentially the same as long as you use FindCreativeObjectsWithTag from => within a creative device <= … but this whole thing unfortunately leads to a predicament in the area of what the original poster discusses.
I have been using tag since the begining or UEFN. I just don´t understand how to use this specific specific new function.
That video show how to use GetCreativeObjectsWithTag but I don´t undertand how to use the new, as it is use a interface. I need a code example to undertand it
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
hello_world_device := class(creative_device)
{
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
{
# TODO: Replace this with your code
#Print("Hello, world!")
#Print("2 + 2 = {2 + 2}")
DoNotFollowThisExample()
}
DoNotFollowThisExample():void=
{
TaggedActors := FindCreativeObjectsWithTag(my_device_tag{})
for( TaggedActor : TaggedActors )
{
# Print("Why, hello there!")
}
}
}
The “my_device_tag” thing is your tag. With your name. Which you should already have, or can make like in the video.