Best way to reference an actor inside widget BP?

Hello, so i’m working on a generic pickup item in my level, the way it works is if i walk over it with my basic fps character, it disappears and then appears again after 5 seconds, so i did that, but now i want to make it look a bit more fancy and have a visible floating timer in the place of the item while it’s respawning to show how many seconds left until it respawns. And this is where i struggle. So the way i tried to do this is I made a “Widget Component” (screenshot) inside the pickup item actor BP which i placed where i want it to be, and then made a new widget BP, which i assigned to that widget component. This new widget BP is nothing but just a text with a number of how many seconds left until respawn. So now that i have it displaying properly in the world, only thing left to do is to communicate the Pickup item BP to that timer widget BP, so that i could have access to the timer variable of the item BP and change the number which this widget is displaying. So here i couldn’t find a good way of referencing the item inside the widget BP. I think using “on actor begin overlap” would work, but i don’t know how exactly i should implement that. Any ideas? Thanks.

I don’t quite understand what you try to do. A pickup where after overlap the mesh is hidden, and a text is displayed can also be archived with a textRender Compontent inside the pickup actor bp. You can go the way with a widget, so you can create a UMG with a variable exposed (like timerSeconds : int) or better a function to trigger it. Then on overlap in the pickupActor hide the mesh, and set the nodes like in the screenshot to fire up the widget timer. I personally would go with a text render if you really only want to display text timer.

286925-bp.png

if you want access to the pickupActor from within umg, just create an actorRef (or pickupActorRef) Variable in the umg and set it like above from within the pickupActor to “Self”

Im a little confused, but I think I have an answer:

Create a timeline (or some way of counting down) in the pickup BP, then every second (when 5.0 becomes 4.9, 4.0 - 3.9, etc) send an update to your widget via a message or casting to it and sending the number to display, then when the time is up hide the widget again and reset the ‘clock’.

why should you want to communicate between the actorBP and the widgetBP? Just put the logic inside of the Widget - it is BP as well. Just fire up a Timer (1Sec) which updates the text and if it is 0 remove the widget.

Its just another suggestion, could be useful if there are other actors needing to know information form the pickup BP. (AI or whatever) Also, its easier to understand for me.

Just hide the actor that is picked and set the timer to be visible. Than hide the timer and show the actor that can be picked up. When actor is visible you execute the code that detects if it’s picked up.

Sorry for the confusion, i tried to give some context but apparently i made it more confusing. I had the whole pickup system with timer logic working already, i just had a problem communicating the timer to the widget so that the widget would change number, tried doing it with event dispatchers and other excessive stuff. But the “get user widget object” node seem to work perfectly in this case and makes everything muuuuch easier, thank you. Now it works just like i wanted, and to my surprise, each instance of the pickup in the level gets it’s own separately working timer, i thought i would have to make a speratate widget for each instance. Here’s the way i made it, the timer is a bit stupid and maybe the whole BP could be optimized, but it works.

Sorry for the confusion, i tried to give some context but apparently made it more confusing. I got it working now, if you’re interested see my other comment

Sorry if my post was confusing, i had the pickup working already, just didn’t know how to make the visual representation of the timer work properly. i got it working now, if you’re interested see my other comment