# FindCreativeObjectsWithTag return nothing

**URL:** <https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [December 9, 2024, 11:49am UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263 "2024-12-09T11:49:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 9, 2024, 11:49am UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/1 "2024-12-09T11:49:22Z")

</div>

Despite 2 devices with the tag are in the map I got 0 devices with this code :

```auto
# This function runs when the NPC is spawned in the world and ready to follow a behavior.
    OnBegin<override>()<suspends>:void =

        if:
            # Get the Agent (the NPC).
            Agent := GetAgent[]

            # Gets the Fortnite Character interface, which gets you access to its gameplay data 
            # including its AI module for navigation and focus.
            Character := Agent.GetFortCharacter[]

            # Get the Navigatable Interface, this allows you to tell it to move.
            Navigatable := Character.GetNavigatable[]

            # Get the Focus Interface, this allows you to tell it to look at something or somewhere.
            Focus := Character.GetFocusInterface[]
        then:

            TagGenerator := FindCreativeObjectsWithTag(PADTag{})

            for(Element:TagGenerator, PAD:=player_light_device[Element]):
                Print("Adding player_light_device")
                set PlayerAttachmentDevices = PlayerAttachmentDevices + array{PAD}
            
            Print("player_light_device count = " + ToString(PlayerAttachmentDevices.Length))

```

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [December 9, 2024, 12:04pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/2 "2024-12-09T12:04:14Z")

</div>

You sure you’re even trying to fetch them here ? Does the final print show ?

---

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 9, 2024, 12:10pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/3 "2024-12-09T12:10:23Z")

</div>

It prints “player\_light\_device count = 0”

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [December 9, 2024, 1:19pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/4 "2024-12-09T13:19:34Z")

</div>

Assuming player\_light\_device is a creative\_device, are you sure you added the tags on them

---

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 9, 2024, 1:28pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/5 "2024-12-09T13:28:11Z")

</div>

100% sure.

in [(InNPCBehavior:npc\_behavior).FindCreativeObjectsWithTag extension | Unreal Editor for Fortnite Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/findcreativeobjectswithtag-2)  
they say :

> Blockquote  
> Generates a `creative_object_interface` for every creative object that has been marked with the specified `Tag`. Will not find anything if called on an `npc_behavior` that is not simulating.  
> Blockquote

Does it simulate in OnBegin ?

---

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 9, 2024, 1:31pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/6 "2024-12-09T13:31:10Z")

</div>

![tagged device](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/5/98592b58f0b618098ee69aea90a6ab4a4facd206.jpeg)

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [December 9, 2024, 1:53pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/7 "2024-12-09T13:53:10Z")

</div>

Does it work when you try to access those devices outside of the NPC behavior using the `(:creative_device_base).FindCreativeObjectsWithTag(:tag)` method instead

The behavior method was just added during last update maybe it’s broken idk 🤷

---

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 9, 2024, 2:05pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/8 "2024-12-09T14:05:55Z")

</div>

It work in the _player\_light\_device := class(creative\_device):_  
So it’s a bug in the _npc\_behavior_ class.

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [December 9, 2024, 2:10pm UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/9 "2024-12-09T14:10:53Z")

</div>

haha great, can you try to add a delay before fetching from the NPC maybe ? Otherwise you’ll need to come up with a custom solution like this

> [@NPC behavior and FindCreativeObjectsWithTag best practice](https://forums.unrealengine.com/t/npc-behavior-and-findcreativeobjectswithtag-best-practice/2107457/7):
>
> Great stuff. Managed to resolve the issue based on your direction. Thanks! For anyone else facing similar issues, I did the following (I imagine there might be cleaner ways to pull this off): Setup a weak map in the creative device required to be called from the npc\_behavior. var GameManagerMap : weak\_map(session, game\_manager) = map{} Populate the weak\_map in the OnBegin method of that creative\_device: var currentSession : session = GetSession() if (set GameManagerMap[currentSession] = S…

---

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 10, 2024, 8:15am UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/10 "2024-12-10T08:15:17Z")

</div>

_Unknown identifier ‘GameManagerMap’_ in npc\_behavior, which looks logic.

---

<div class="post-metadata">

**Author:** ![AZOM-Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azom-games/32/997248_2.png) [@AZOM-Games](https://forums.unrealengine.com/u/AZOM-Games)\
**Post date:** [December 10, 2024, 8:20am UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/11 "2024-12-10T08:20:19Z")

</div>

Got it. The GameManagerMap var must be defined outside the class.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 9, 2025, 8:20am UTC](https://forums.unrealengine.com/t/findcreativeobjectswithtag-return-nothing/2188263/12 "2025-01-09T08:20:23Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
