make map of different components in BP

This is probably super common but since im a newbie i dont know exactly what to look for.

I made a number of drawer that open and closes when they are interacted with from the player line trace. Right now
I want to be able to open and close the drawer one by one but i cant figure out how to get the reference to the specific component that has been used. as of now the drawer open but cant close.

I try to Challenge myself to make everything more dynamic in my BPs so i dont want to make code for each drawer but i try to make what i think is called a Map so see which drawer has been opened.

You can see my problem in the video. (and probably in the BP as well) anyhow im stuck and would really appriciate some input on what to look into.


From the behavior in the vid, I’d say you used ‘play’ on the timeline, and then used ‘play’ again on the same timeline for other drawers.

You need to use ‘play from start’ to get the timeline to start again.

When you make a line trace to the blueprint, you get to know which component you hit, as well as the actor


There are many ways you can go about this, one BP with drawer meshes, is one. Or, make a blueprint that can play a timeline when clicked, and inherit from that BP to make separate drawers and doors later.

Hey and thanks for the reply, im getting the right component from the linetrace, but i can get my “map” to go false from the branch so it never closes. Feel like my logic in the map is way off…

When i use play from start the drawer starts over from 0 everytime and never closes.

I remade my logic abit but its still off.

my Idea with the code is that when a component in the BP is hit, its checks if it has been hit before with the contains node, if true go to the flipflop to open or close. if false Add component to the Map and then do the flipflop.

But as you can see in the new video, it opens and closes but the timeline messes up… as long as i only target one component it works fine but when i jump in between it doesnt work.

I can’t see any of your code :slight_smile: Can you make the piccies bigger?

I assume you’re using the bool in the map to indicate if the drawer is open? If so, you need to update the map each time the drawer is opened / closed.

Here’s my take on this:

  • create a static mesh component - that’s the shelf / cupboard / drawer - any independent, modular, movable bit you want:

  • give it a mesh, add an interface and script (the Over Time speed can be made more consistent):

  • add drawers to the actor:

You can expose some data to make them unique, have loot, different behaviour and so on.

  • operate on them with a line trace or whatever returns the component:

There’s no script in the actor itself:

This work perfectlly and also makes it so easy to change the mesh and varibles!! thanks so much!

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