Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

TextMesh Pro as Mask in Image UI Component

Discussion in '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. Boolable

    Boolable

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

    schirDev

    Joined:
    Mar 7, 2018
    Posts:
    12
    +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. KarlKarl2000

    KarlKarl2000

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


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

    mahu

    Joined:
    Apr 6, 2014
    Posts:
    8
    4 years later and I'm here looking for this feature
     
  16. BranislavZ

    BranislavZ

    Joined:
    Aug 16, 2023
    Posts:
    1
    So, can we use TMP as a mask source for other sprites?