Blueprint information into Widget

Hey guys,
i am using version 4.5.1

My current situation:

I have a timer, made as widget blueprint, which is working fine.
Now i need to get the current value of the player income, which is set in a normal blueprint, into my widget.
But how do i call the normal blueprint ? All things i tried ended up in “current value - none” when i watched the values.

Hope you guys can help me.

Hi Nijuky,
You’ll need to get a reference to your BP where the income value is set. In your Widget, just cast to that BP and then get the variable from it.
I kinda go through the same type of setup in one of my videos:
Start at time 4:45-ish
My timer is on the Pawn BP and the value is passed to the Widget. So, you can do the same thing, but for your income variable.

Okay, i got that working … but i got a new problem…

first some screens:

Function Graph.png

i’ve got 2 player which i need to seperate… so i did it via the player number
for player 2, all is working fine … but when i use player 1, the number (which shows the income amount) is being placed behind the timer… both use the exact same settings, just some little position differences … in both versions, it is working fine for player 2 … and in both versions its not working for player 1 … it gets the correct income amount value, but the positioning of the text gets changed behind the timer … and i really don’t know why …

Try raising the zOrder of the text, it may just be UMG being finicky.

i tried to raise the zOrder … i put the timer icon to zOrder 0, and the text to 1… also i tried to put it like … timer to 5 and text to 20 … still the same bug … i don’t get why :confused: both use exact the same way … but for 1 player the text gets placed under the timer and for the other not … even when i dont use a function for the text, it gets printed above the timer icon … it’s just for the 1st player :confused:

It’s a batching issue, the way slate is drawn each widget reports what to draw. If it needs to it manually increases the layer that each element is drawn on, it usually does. If it does this too often, then you’ll have no batching because each item is getting a separate layer and draw call. Currently the zorder is a hint, but it doesn’t override the batcher’s ordering for the canvas. The blueprint editor has the same problem if you’ve ever dragged two nodes over top of each other you’ll see weird interleaving.

We need to upgrade the canvas to do some rect overlap tests to determine if new layers are needed to resolve the draw ordering correctly. For the time being you should be able to fix it by actually parenting one widget to another. Use something like nested canvases, or an overlay panel to let the widgets overlap. Or make the image a Border instead of an Image which can take a single child widget, which could be another container or the text you want to display.