Search Unity

Question I have a problem. When i used sprite tag to show sprite (obviously) and some effect with it.

Discussion in 'UGUI & TextMesh Pro' started by Doko, Apr 7, 2023.

  1. Doko

    Doko

    Joined:
    Aug 1, 2014
    Posts:
    4
    Hello.

    When I used sprite tag to show sprite to show sprites what i want to, with some effect( with codes ) there's problem.

    first. there are 2 weird icons in the picture.

    that 2 sprites is shown by using sprite tag.


    textmeshprougui.png

    and sometimes i use this code to give an effect to TMP ( I used TMPUGUI object anyway )


    codes.png

    this code is an effect that tmp is wobbly. ( I don't know this expression. I just copy this from youtube. the effect you can see at the #1 Image. some letters are 'wobbly' )

    anyway. what I found is that.

    when this wrong happens, TMP object automatically generates
    SUBwhat.png

    'TMP subMeshUI'.

    actually in the above picture, there's an image next to word in yellow box(실패!). that should be there.

    I don't use Sprite at that.

    what i can think is because of codes, maybe some clear or i don't know whatever, about textmeshpro makes this.

    and about codes, that codes just make vertex moving. the problem line i think is

    ForceMeshUpdate() or UpdateGeometry().

    but. Update Geometry is literally update vertex's position so it seems like moving.
    so i think ForceMeshUpdate is the problem.

    but, why, i don't know i think it happens.

    when i don't use sprite tag at that time, but previous what i used sprite tag image suddenly pop out.


    ---
    thanks for reading my question.
    I hope you help me!
    and sorry about poor english skill.

    and this is the first time to write. so if i may do something wrong. please tell me.
    I will fix.

    thanks agian!
     
  2. Doko

    Doko

    Joined:
    Aug 1, 2014
    Posts:
    4
    I solved myself.
    it tortured me almost few weeks with some other stuff.

    the problem is going to happen in this way.


    1. I use object pool to reuse objects. in that pool I also use TextMeshProUGUI.
    2. when I get one TextPanel(has TMP_UGUI), I pass a string to show (because of it's purpose, tmp is exists for showing text)
    3. when I show string via TextPanel(again it has TMP_UGUI), if you use rich text( including tags in this case especially <sprite... tag to show images in tmp_ugui), it automatically generate submeshUI.
    4. after I used all TextPanel, then I back it to pool to use later, it once generated SubMeshUI.
    5. When you get a TextPanel from pool, if TextPanel used before also using SpriteTag, it also has submeshUI. ** THIS IS THE PROBLEM point**
    6. when i don't use sprite tag, but it already genereated some weird stuff in my game.

    ---> above, that's the problem process.
    ---> below, how to i handle it.

    1. TMP_UGUI is for shoing text. so check input string.
    2. if string has tag, especially sprite tag, you have to activate submeshUI ( for this u have to get this. ), if you don't have tag, just turn it off.

    that's what i do. and problem solved. and for now it's good.
    the most important thing is i already know what is the problem point. so i can now solve this problem.

    please this solution helps someone like me!

    have a good day!