UI: Button and TextMeshPro are visible in Scene Edit but not in Play Mode

Hello!

I am working on a 2D-shooter and I want to add a pause screen. It’s a defined image and on that should be a heading (Paused)

and a button with text (Un-pause). In scene edit the heading and the buttons are visible, but in play mode they aren’t. I checked if the text and button were maybe too far outside or hidden by the image, I tried to newly sort the layers etc. but nothing worked.

Has someone faced a similar problem and/or knows how to solve this?

I am happy for all kind of help!
Thanks in advance

Best regards

might be a unity bug, so might need to upgrade to a newer patch/minor version
did you try disabling the purple image to see if the buttons are behind it?
that’d cut the debugging space significantly

does it also happen at runtime or just edit-time?

also, make sure you don’t use any of the “skip domain reload” or stuff like that that doesn’t clear unity’s runtime on exiting playmode. it was a horrible decision from Unity to even have that (I think they have it now as the default?): Unity - Manual: Code and scene reload on entering Play mode (basically disable all these)
I’m not sure this will solve it, but it’s one of those things that could induce very hard-to-debug issues

Thank you for your answer!
Yes, I also tried to add the purple image to a background layer to make sure it’s not in front.

It unfortunately happens in both run- and edit-time…
I also checked now if I’m skipping domain reload but domain and scene will be reloaded, thanks for the tip anyways.

1 Like

no, I mean disabling the component (its game object still active) to see what’d behind it

The purple UI backdrop is the parent object, just disabling it also disables the button and the TextMeshPro, of course I can adapt that, but sorting the purple UI backdrop to a ‘second’ background could have been a solution in case the button and text were beneath it, that’s what you meant, right?

Screenshot 2024-12-16 at 15.07.06
I meant disabling the image component just temporarily to see if the other objects are behind it.
this won’t bring much to the table, but that’s the first step I’d take

did you start on unity6 directly? I’m wondering if this is a bug on their side. if you could test this in a more stable version prior 6, that’d rule out this possibility

obviously the children of an object should be on top of it.
what I’m ultimately doing in these unintuitive cases is I’m just recreating that relevant part of the hierarchy in a new scene, or even in a new project, and see if the behavior persists. then, if not, try to bring it as close as possible to what I have in the real project and along the way you’ll in 99% of cases discover what’s different. that 1% is just magic bugs which need a cache invalidation like deleting your Library/Temp folders (with unity closed)