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.

Question How to adjust Link collision box size with Sprites in text?

Discussion in 'UGUI & TextMesh Pro' started by ArnoldRauers_Tinytouchtales, Nov 24, 2022.

  1. ArnoldRauers_Tinytouchtales

    ArnoldRauers_Tinytouchtales

    Joined:
    Jan 25, 2015
    Posts:
    32
    Hey,

    I have texts with Icons and I want to have tooltips when I hover these icons. But it seems that the collision box of links is bound to the text height of the font and ignores the height of my sprite icons.
    Is there a way to manipulate the collision boxes somehow?

    Image for reference:
    Bildschirmfoto 2022-11-24 um 14.35.14.png
     
    Last edited: Nov 24, 2022
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    You can sort of manipulate this by setting "Face Info" metrics for your sprite asset. So instead of using the metrics of the font asset, it will use those of the sprite asset. Below is an example of metrics that I set for the EmojiOne sprite asset.

    upload_2022-11-24_20-44-19.png

    The Point Size will affect the size of the sprites. The Ascend and Descent lines will increase the height of the region which is use by the link tag as seen below.

    upload_2022-11-24_20-45-46.png

    Let me know if that works for you.
     
  3. ArnoldRauers_Tinytouchtales

    ArnoldRauers_Tinytouchtales

    Joined:
    Jan 25, 2015
    Posts:
    32
    Thanks @Stephan_B for the quick help.

    I can confirm that this actually worked super nice.
    Big shout out to you, Text Mesh Pro is crazy good on all fronts!

    Bildschirmfoto 2022-11-25 um 11.07.07.png
     
    Stephan_B likes this.