Line trace display widget on overing

Hello !

So recently i got some help as a beginner to use LineTrace to actually interact with actors

The problem is that now that i can interact with them, i would like to display a little dot with some text under it when i’m looking at those actors ( in my exemple, a door bell when looking at sayin “Press LMB to interact” )

For now i tried to duplicate my basic interacting, switching LMB as a trigger to Event tick ( would probably swap to an update ever time Axis Y and X changes so it check at every mouse movement and not every single tick ) but the problem is :slight_smile:

I managed to display my UI, but can’t find a way to remove it when i’m stopping overing the actor. So here’s my TPC Blueprint :


if it hits the actor, it checks if it have the interface i want, and so creates the widget and add to viewport, if it doesn’t have that interface ( so everything else in my case ) it remove it from parent, but actually the remove from parent isn’t working !

Sorry if you see huge mistake on my blueprint, i started UE4 yesterday so still a looooot do learn

Here’s the thing, Tick executes every frame - you probably do not want to create 120 widgets per second for the rest of the game. While the Garbage Collection may be able to keep up with that, it’s quite wasteful.

Consider creating the widget only once but keep it hidden:

At the most fundamental level we want something along the lines of:

Rather than creating new widgets, we show / hide the one created at the beginning of the game.


The above can be further optimised with a couple of DoOnce nodes and logic gates. But perhaps that’s enough here. I posted it once but can’t find it now :expressionless: - serves me well for talking so much…

1 Like

Fast and clear answer again ! thanks a lot, got me stuck for a while today :smiley: