Search Unity

Text Mesh on 2d sprite and sorting layer problem

Discussion in 'Immediate Mode GUI (IMGUI)' started by FiftyYtl, Dec 21, 2018.

  1. FiftyYtl

    FiftyYtl

    Joined:
    Dec 2, 2018
    Posts:
    14
    Hello everyone;

    I'm having trouble about sorting sprite and text together.

    I have multiple 2d game objects moving around and they all have text on it. I couldnt add text mesh on sprite because it conflicts with the sprite renderer so i created a child element and i added text mesh to it.

    But i cant order layers, text is always in front of the all other objects.

    For example; i have 3 balls on the screen and each have their sorting layers as "ball" and they have order in layer like 1,2,3. Big ball is always in front and the others behind them. And i added these objects empty game object and added Text Mesh to them. When i move balls text is always in front for all balls. I want big ball in front with its own text and the other balls behind it with their own text.

    Text Mesh doesnt have any sorting layer option, i guess its sorting layer is always "Default"

    How can i order objects with the correct order ?

    Thank you.