The code I have here places a button prompt text form a widget above an actor, and moves as the camera does to stay above said actor. The issue arises when the actor leaves the screen, causing the text to disappear, and not reappear on screen until the event is called again.
I’ve worked out that when the actor is off screen, ‘Set Position in Viewport’ is what breaks things. If I were to replace it with a ‘Print String’, printing the screen position, it’ll continue to work as intended.
I’m new to blueprints, so I am unsure on how to prevent this and what checks to put in place. Thanks in advance.
You are using the output pins of “MarkerCalled” within the Tick execution flow. This is terribly bad practice.
I don’t know if it’s actually the source of the issue, but try storing Location from “MarkerCalled” into a variable, and use that variable when projecting.
I’ve tried storing at as a variable before and after converting to a screen location to no avail. The issue is still isolated to the ‘Set Position in Viewport’ node, but noted.
You say the widget reappears on screen when the event is called again?
All the event does is setting Loop=true and setting widget visibility.
If you call MarkerEnd at some point, then it is normal that your widget disappears, until you call MarkerCalled again.
Am I getting your issue wrong? maybe post some additional info
Widgets that are off-screen do not tick. Once it’s moved off-screen, it cannot reposition itself back because it’s not ticking. It’s stuck there, in blissful limbo.
A couple of solutions to this:
if you need widgets that live outside of the boundaries of the viewport, use widget components - and, as a bonus, there will be no need to update their position, it’s done automatically
have another actor update the position of the widget, the actor can tick and tell the widget where to go. However, if you tell the widget to set a position that is really far, it will also break in a strange fashion. To solve this, you can clamp the 2d vector, so it does not grow too large.