Download

DrawText and DrawRect Stack order / z-index?

I have a basic “Game Over Screen” through draw text, and a rectangle that takes up the entire screen, is slightly opaque. Just to make it a little easier to read the text. The problem is the text is showing up behind the rectangle, regardless which I call first (drawtext then draw rect / draw rect then draw text). Looks like this, you can see the color of the rectangle is OVER the text. Just want to switch it:

7db4f165b8f3fc17b1f6ba90c9bf23a110b0b4bd.jpeg

If I was doing web design I could control this through z-index in CSS. How can I get that functionality here through blueprints?

Thanks,

Things that get drawn first are at the back and things layer on top. I myself haven’t had any issues like this, could you post a screenshot of you BP please?

Sorry for delay - big storm just came through and internet was down.

Here is how I have it setup currently:

875e32298688249b74798069f6eee807842dfdb8.png

I have also reversed it so the Draw Rect occurs first, and then the draw text happens, and I get the same result.

It is all coming through a single Event Draw HUD. I have the them split up through a sequence node way up the chain. Would that have any impact?

A larger perspective:

d61c81038c60a785b7b651377245a910e1d92f5d.png

If so, how can I stack Draw Text and Draw Rect at the same time, and get the visual order I want?

Well first switch them around and compile because the way you currently have it, it will draw incorrectly.

I switched, compiled, didn’t get any errors and the results were the same:

Here is what my blueprint looks like now:

14454193a6a2657867b7e8a1d267bdb6645cfeff.png

Something is up with the forum I think and I can’t post the resulting image - but I see it on screen, the rect is in front of the text.

Remove the line to the draw text to make sure it’s the correct text you are working with.

I think it may be happening because they are called right after each other.

Leave everything as is up to the draw rectangle node, remove the link from the draw text node, and then replace the input node for draw text by adding another pin on your main sequence node, and take that execution wire and plug it into the DrawText node. This will make sure it runs in the proper sequence, and hopefully is what you are looking for

Just wanted to see if that made any difference, let us know if it does or doesn’t work!

Hi everyone, I am an idiot.

@DarkHorror seems to be correct, I was confused with which of my drawTexts I had tried to layer on top of my drawRect. While my wires are a little messy now, it works!

Thanks for the input @DotCam.

Happy hump-day.