Widgets are disappearing 4.9!

Hi I posted this on the UE4 AnswerHub but I have not get a reply, so I post it here hoping someone can help me:

New Edit: seems that the problem is because “Set position in viewport” function, taking the position from “ConvertWorldLocationToScreenLocation”. Using “Set transform” it seems to work but not as I would like.

How are you creating the Widgets? Are you removing them at any point? Like when the enemy moves off screen?

I make them to set their opacity to 0 in some cases, but that is not the problem, I disconnected that node and they still disappearing.

They are not destroyed, but their event tick is not called any more D: It worked fine in 4.8.3!

Edit: I destroy the widget when his Owner(in this case, the enemy) is not valid. The widgets are children of the viewport, they are not widget component or positioned on the world. I just use a ConvertWorldLocationToScreenLoc.

I have such problem in my game. And also, in 4.8.3 all worked corectly. I will look engine code to determine why this problem occurs. I would say you if I’ll find workaround for that.

I realised that widget tick function is called from coresponding slate widget Paint function, which is called (in case if widget was added to viewport) only if widget geometry is still intersected with viewport one (SConstraintCanvas::OnPaint). So, if you moved your widget outside of viewport rect, then you will no longer receive Tick. Only way to avoid this I see is detecting such situations and just hiding widget, but don’t move it too far. Or you can try to find any other function (nor Paint nor Tick), which is called always. I think such behaviour is just optimisation of Slate rendering.

UPD: I placed bug report on AnswerHub for that: Link.

I’d say it is intentional for a widget not to tick while it’s off screen. You could try not allowing the widget to move off screen, by clamping it’s position and settings its visibility rather than its location at that point. Also you could manually tick them by calling a function on it from wherever you have created the widget, and really you wouldn’t need to do that unless it’s gone off screen.

I think so but it makes things bit harder. I thought that result of UGameplayStatics::ProjectWorldToScreen will be false if result position itself is outside the viewport rect, but it doesn’t. May be exactly that is a bug, I don’t know. I tried to use timers but it seems too uneficient and hacky. So I will try to calculate predicted widget margin and test its intersection with parent geometry. I don’t want my widget to dissapear when its center will be out, it doesn’t look good.

It doesn’t return false as it can return values outside the actual screen size (including negative values), it only returns false when it can’t return any value, such as when the player is facing past 90 degrees from the object. So really you’d have to manually check that the value is within range yourself by getting the current screen resolution

edit: It could be a bug, but there is definitely times when you’d need values outside the screen size, when drawing HUD elements for example.