Ue5 - adding npc interactable objects dynamically

hi all, been stuck on this for hours as there is no tutorial / answers for my problem.

my game is about selling cupcakes to ai npcs, these cupcakes are actors in my scene. when i press e, i pick one up (the original actor is deleted, and a static mesh appears in the player’s “hand” to show what is selected)

when i press e on the counter, the static mesh is deleted and a new cupcake actor spawns on it (to show i placed it down). for the convai npc to pick up this cupcake, it needs to have been added in the ‘objects’ section in the details panel. but i want to do this dynamically as each cupcake that spawns on the counter is not originally in the scene.

when i hover over the ‘objects’ it says “use the environment object on the chatbot component to add objects programmatically or during game mode” but i wasnt sure how to use this. this is what i have so far (nowhere near working) and its confusing because my cupcakes are actors so i had to turn them into a convai object entry type. btw this is in my convai npc’s blueprint

if anyone can help i would really appreciate it !!! :')

edit: just changed some things around, i think this is an improvement, still doesnt work but i think its closer to my answer.

new:

Hello @xionoodlebear,

Welcome to the Convai Developer Forum!

Thanks for your patience, and apologies for the delayed response. We’ve been experiencing some high volume recently.

There are two recommended ways to dynamically add objects like your cupcake actors to a Convai character’s environment at runtime:

Method 1: Using Class References

In your Convai NPC Blueprint:

  1. Use the Get Actor of Class node to find your spawned cupcake.
  2. Access the ConvaiChatbot component and get its Environment object.
  3. Use the AddObject function to register the cupcake with the environment.

Method 2: Using Tags

If you’re spawning multiple cupcakes dynamically:

  1. Add two tags to each spawned cupcake:
    • One common tag like Object
    • One unique tag like Cupcake
  2. Use Get All Actors with Tag to collect all cupcake instances.
  3. Loop through them and call AddObject for each.

This allows your NPC to recognize and interact with the cupcakes, even if they weren’t part of the original scene.

We’ve attached example screenshots to help visualize the Blueprint setup.