Hi,
I have created a blueprint called BP_ObjectDetection
which draws a bounding box on a static mesh component. This blueprint allows a user to select a static mesh from the editor once as blueprint actor instance has been placed in a level.
If I define event graph with the Begin EventPlay node, and connect it to my Draw BBox function, all three object bounding boxes appear when I press the play button.
However, if I disconnect the Begin EventPlay node and connect a Keyboard Event B to the Draw BBox function as shown below and run the game, a bounding box is displayed for only one actor.
Q01: What should I do to display a bounding box for all static mesh component actors in the scene that are created using my BP_ObjectDetection blueprint ?
Thanks!
Hey @elvis.dowson!
Could you show us the code for your BP_ObjectDetection?
I’m thinking it has something to do with your variable reference being singular and BeginPlay running on every creation AT creation…
Have you tried “Detect,create,detect,create,detect”?
Hi,
I have attached screenshots of the graphs for the three functions. I’m using UE5.5.4
Function: Get Vector Permutations ()
Function: Get Bounding Box ()
Function: Draw BBox()
BP_ObjectDetection Event Graph:
Thanks!
Hey, great start!
But where are Get Bounding Box and Get Vector Permuations being called?
Also, how are you setting the “Static Mesh” variable?
Also I noticed you using the () at the end like in C++,
In BP, I like to use F_GetVectorPermutations and Event_BlahblahEvent for distinguishing. 
Hi,
Only the Draw BBox function is being used right now.
The static mesh variable is assigned to SM_Chair by default.
Here is a screenshot of the construction script for BP_ObjectDetection
Once I drag a BP_ObjectDetection actor to a level using the main editor, I change the default SM_Chair to another static mesh using the main editor.
Okay, I’m starting to see here.
There are multiple BP_ObjectDetection’s in this scene: Two that are chairs and one that is a table, correct?
So what you need to do here is have a dispatcher, if you want to hit all of them!
Check that out, look specifically at the dispatcher section.
You’ll need the input (“B”) to be taken in somewhere OTHER than these actors (because only one actor can accept the input) then trigger an event dispatcher, and the BP_ObjectDetection’s need to have a delegate that is listening for that dispatch. Then off THAT run your lines. 
Hope that helps!
I created a separate BP_Button
actor blueprint with no static mesh and added it to the level, along with the three BP_ObjectDetection
actors with an associated static mesh.
BP_Button
actor: I defined the following event graph, to generate an event OnDisplayBoundingBox
. The variable IsActive is set to true when the button is pressed, and false when the button is released.
BP_ObjectDetection
actor: I modified the event graph to bind to the OnDisplayBoundingBox
event and wrote an event handler to trigger the bounding box.
When I run the example, it shows three messages indicating that the three BP_ObjectDetection
actors have bound to the event listener.
However, when I press the key B
, nothing happens.
I notice that even from the BP_Button
actor, if I try to print a string from a Key B
press, nothing gets displayed on the screen.
Q01: What should I do to get the BP_Button actor to correct respond to Key B
pressed events?
Solution Update:
A01: I had to set Auto Receive Input
to Player 0
to get BP_Button
to respond to player inputs.
Now the bounding box gets displayed for all three BP_ObjectDetection
actors when Key B
is pressed.
Hey @elvis.dowson!
Sorry for the late reply, stepped out for a few days.
It looks like you managed to get it figured out! That’s awesome! Don’t forget to mark your solution! 