Search Unity

TextMesh Pro as Mask in Image UI Component

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by felipeap92, May 16, 2017.

  1. felipeap92

    felipeap92

    Joined:
    Jan 7, 2014
    Posts:
    8
    Hi there,

    What I'm trying to do is make a TextMesh Pro Mask in a Image UI component, but i just can't... Could you guys help me?

    What i want to do is similar to the image HERE

    Thanks =]
     
    Last edited: May 16, 2017
  2. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    The image is broken, but I think I know what you're trying to do. The problem is the mask needs an image lookup, whereas the TextMeshPro object is rendered with a shader. You'd have to use another camera to render that to a render texture or something and use that as a lookup texture for the mask.
     
  3. felipeap92

    felipeap92

    Joined:
    Jan 7, 2014
    Posts:
    8
    I don't know why the image got broken, but here is the link: IMAGE

    Is it possible do to this with the solution you propose? I ask that because the rendered texture should be "inversed" of the actual text so the mask could have this effect... Any idea?
     
  4. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    What is it you really want to do? You want a green 2x here? I'm assuming the green is a texture, you want this texture to show only where the 2x is? If that's all you want to do, TextMeshPro supports texture mapping, it could be as simple as clicking a few things and plugging a texture in.

    The solution I proposed was less of a solution and more of a long, hackish way to do what I thought you were proposing. It won't be a good solution at all.
     
  5. felipeap92

    felipeap92

    Joined:
    Jan 7, 2014
    Posts:
    8
    No, no... What i want is make the image (green image) becomes transparent where the text is ("2x" text). Similar to THIS image...

    Do you know if it is possible with TextMesh Pro?

    Thanks. =]
     
  6. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    Yes, I'm quite certain that's possible with TextMeshPro, look at the manual.
     
  7. felipeap92

    felipeap92

    Joined:
    Jan 7, 2014
    Posts:
    8
    I don't think they have this kind of feature natively.. At least i didn't find in any manual, video and even googling it...

    The only thing i have found is THIS GitHub project, but i couldn't achieve what i want with it. :/

    Any solution?

    Thanks.
     
  8. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    So this is what you want to do?



    The options are right there, front and center on the TextMeshPro object. I even checked, it's in the PDF that comes with TextMeshPro that tells you exactly how to do this.

     
  9. felipeap92

    felipeap92

    Joined:
    Jan 7, 2014
    Posts:
    8
    No, that is not what i want to do... What i wan to do is this:





    Where the TextMesh Pro is, the image should become transparent and those pixels should not be rendered. Like Unity Mask component does but inverse...
     
  10. Grew

    Grew

    Joined:
    Jun 28, 2015
    Posts:
    2
    Hi @felipeap92, did you find a solution for this ?
     
  11. TheFinalRespawn

    TheFinalRespawn

    Joined:
    Mar 7, 2018
    Posts:
    2
    +1 anyone successful with this approach?
     
  12. JeffForKing

    JeffForKing

    Joined:
    Apr 8, 2014
    Posts:
    25
    +1 for this awesome feature
     
  13. Skyboard_Studios

    Skyboard_Studios

    Joined:
    Jul 20, 2013
    Posts:
    51
    +1. I am looking hard for this.
     
  14. indieDoroid

    indieDoroid

    Joined:
    Jan 25, 2016
    Posts:
    146
    +1 @Stephane_B


    I'd love to be able to use TextMeshPro as a mask for image too! :rolleyes: