How to work with Text component on multiple layers (one layer per popup)?

I’m creating a game on Unity. In my game, there a popup for each screen(i don’t want to create lots of scenes).
To create a popup, i do the following:

  • create a new layer for it, go to “edit layers… → sorting layers” and add my new layer on a position that’s after my last screen
  • Create a new canvas gameobject on the project. It’s render mode is “screen space -camera” and sorting layer is my new popup layer and it’s order in layer is 0
  • Create an empty gameobject inside my new layer(Let’s call it EMPTYGAMEOBJECT) and put a sprite renderer on it. It’s sorting layer is my new layer and it’s order in layer is 0
  • Create all other gameobjects that should be in the popup and put them inside EMPTYGAMEOBJECT(just drag them to EMPTYGAMEOBJECT on the gui). Then, for each gameobject i put a sprite renderer on it, still at the same layer but now the order in layer is 1(or maybe 2, if some object is supposed to be above other)
  • When i want the popup to appear, i call a function that brings EMPTYGAMEOBJECT(and therefore all gameobjects inside him) back to it’s original position. When i don’t want the popup to appear, i call a function that moves EMPTYGAMEOBJECT(and therefore all gameobjects inside him) to a far far place on the screen

  • This method is working fine with simple gameobjects, but i’m currently having problems with text. I treat him like any other gameobject that should be inside EMPTYGAMEOBJECT, i even give him a sprite render althrough he already have a canvas renderer which i can’t remove. Sometimes, the text appears normally, but other times, the text isn’t showing anything. It looks like it’s below all things or something.
  • My brother asked me to build a new canvas for the text. I did, and made the canvas on the same layer as the EMPTYGAMEOBJECT canvas but in a higher order(like, order in layer = 1). Still didn’t work.
  • How do i treat text if i create my popups on different layers?

obs: I have discovered that sometimes the text doesn’t appear because it’s order in layer is not the other object + 1, but sometimes even changing the order seems like it doesn’t do anything

I fixed it by doing these things:

  • The text was too small. I enlarged the area of the text(strangely, if the area is too small, even when the text is small it won’t appear)
  • Moved the Text gameobject to a new canvas
  • Made the canvas which had the Text object have an order in layer that’s larger than my old canvas with all the gameobjects except the text
  • Finally: made sure that some gameobjects from inside “my old canvas with all the gameobjects except the text” be reduced on order in layer(on the sprite renderer)
  • obs: Text doesn’t need sprite renderer