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. Dismiss Notice

Rich Text Quad Problem

Discussion in 'UGUI & TextMesh Pro' started by ToshoDaimos, May 11, 2016.

  1. ToshoDaimos

    ToshoDaimos

    Joined:
    Jan 30, 2013
    Posts:
    679
    I would like to use rich text "quad" tag to insert some icons into my strings. To use it I need to set a material. I'm new to Unity and never used materials before. It seems that materials are set per renderer, but there are multiple renderers for different UI elements. Should I add that material to my Text renderer or to my Canvas renderer? Does material counting start from 0 or from 1? I'm doing everything through scripts.
     
    BDKosan17 likes this.
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    per most array/list structures, it starts at 0
     
    ToshoDaimos likes this.
  3. ToshoDaimos

    ToshoDaimos

    Joined:
    Jan 30, 2013
    Posts:
    679
    To bad that "quad" tag is supported only for Text Mesh which can't be placed directly on Canvas. :/
     
  4. Tesrym

    Tesrym

    Joined:
    Dec 2, 2012
    Posts:
    64
    mcroswell likes this.
  5. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    This feature is not supported with UI Text and the Canvas system.

    If you absolutely need such functionality with the Canvas system, you might want to consider TextMesh Pro which is a replacement Unity's UI Text component as well as Text Mesh.

    TextMesh Pro includes over 30 Rich Text Tags including the <sprite> and <font> tag as seen below where different fonts and sprites can be used in the same text object.


    Animated GIF showing the new Multi Font & Sprites feature available in TextMesh Pro.
     
  6. mcroswell

    mcroswell

    Joined:
    Jan 6, 2010
    Posts:
    79
    Five years later it looks like this still isn't answered. I've tried all kinds of combos and only TMP seems to do this. Question: Why is it still in the documentation for Unity's standard StyledText?
     
    vandim likes this.
  7. MaxLohMusic

    MaxLohMusic

    Joined:
    Jan 17, 2022
    Posts:
    45
    5 years later I'm still unable to figure out how to add the material. You clearly did not need the question "what is this material" answered if you were at least able to do it with TMP. Question is how do you do it even with TMP?

    When I try "<quad material=1 size=20 x=0.1 y=0.1 width=0.5 height=0.5>" it just renders the literal text.

    Is it because I am missing the "material" and if so where do I add these "material"?

    EDIT: In case anyone's still wondering, I think I ended up using sprites and sprite atlas instead.
     
    Last edited: Nov 20, 2022