Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

No rich text in one class but there is in another

Discussion in 'Immediate Mode GUI (IMGUI)' started by Ghidera, Apr 18, 2014.

  1. Ghidera

    Ghidera

    Joined:
    Mar 6, 2013
    Posts:
    53
    I`m experimenting with classes and trying to come up with a self contained chat window. I first created a class to handle game logic then another class to handle a chat window (different file). Both classes are attached to the main camera and the logic class calls a function in the chat class to add a string to the display.

    THe logic class can display colored text in a label (status messages) but when I send the same text to the chat class the markup is visible and no color changes are applied. Even when I add text from within the chat class the markup is visible and no colors are changed.

    the logic class uses guilayout area and a label while the chat class uses a window and a textarea..
    I was thinking maybe richtext wasn`t enabled in the chat class but that doesn`t really make sense since I don`t use a custom skin so if it was off it would have to be off for both classes.

    Any ideas why one works and the other doesn't.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Have you tried a custom GUI Skin so you can tick Rich Text in your textarea style? Maybe Rich Text isn't ticked in the default skin's textarea style. (Sorry, I'm not in front of Unity right now to test this.)

    You can also word wrap labels, so if textarea doesn't work out you could just define the same area as the textarea and use a label.
     
  3. Ghidera

    Ghidera

    Joined:
    Mar 6, 2013
    Posts:
    53
    I just figured out that textarea and textfield don't support rich text. Makes sense really since they're for user entry. I switched to label and that's actually working out well.

    Thanks for the suggestions!