Search Unity

Rich text support

Discussion in 'UI Toolkit' started by Timboc, Jan 31, 2020.

  1. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
  2. benoitd_unity

    benoitd_unity

    Unity Technologies

    Joined:
    Jan 2, 2018
    Posts:
    331
    Should be supported by the end of 2020
     
    AlexTuduran and Timboc like this.
  3. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    End of 2020? Thats a hella long time. Combined with the fact that you insert text as a property and not between tags like in HTML that's a huge oversight and even a showstopper for some, me included.
     
  4. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    I second this. I thought "hey, lets move what I already nicely formatted for Console output into a new fancy Editor UIElements popup, Unity said it's production ready!". Turns out a) Popups in UIElements are hard b) no rich text support. Whew.
     
    Reahreic likes this.
  5. Reahreic

    Reahreic

    Joined:
    Mar 23, 2011
    Posts:
    254
    Yeah the "Production Ready" statements aren't to be trusted here (or anywhere Agile is used). I'd really prefer unity to keep these things in closed beta until they're at least on par (feature wise) with the tech/workflows they're trying to mimic as it leads to having to juggle a mix of assets/tools that may not work together.

    We've had to disallow the use of UIElements in our current project as including them causes our existing tool-set custom editors and inspectors to break when extending their functionality. (AFAIK, you can't show a UIE property drawer inside the inspector alongside an IMGUI property drawer)

    That being said, having spent a decade or so developing HTML + CSS web apps, i know i'd love UIE if they supported the standard CSS spec for styling elements.
     
  6. PlayCreatively

    PlayCreatively

    Joined:
    Jan 25, 2016
    Posts:
    94
    I'd like to know if rich text is supported by now. I don't seem to find any options for it.
     
  7. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    PrimalCoder and PlayCreatively like this.
  8. PlayCreatively

    PlayCreatively

    Joined:
    Jan 25, 2016
    Posts:
    94
    Nice, thanks for pointing that out! Just had to add com.unity.ui through the package manager and rich text is automatically working.
     
    Timboc likes this.
  9. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Has rich text support for UI Toolkit TextField-element yet surfaced in any Unity version?

    I tried going through some changelogs, but couldn't yet find references. I remember it was on the roadmap, I was wondering if there are any updates on it?
     
  10. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    92
  11. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Ah yes, but at that time it wasn't implemented for TextField-element yet (for UI toolkit). So I was wondering if the TextField implementation is still in progress or out already.
     
  12. AlexandreT-unity

    AlexandreT-unity

    Unity Technologies

    Joined:
    Feb 1, 2018
    Posts:
    376
    Unfortunately TextField is a special case that will need to be reimplemented from scratch. At the moment of writing these lines, we're only a few weeks away from our internal 2021.2 feature freeze, so this refactor should take place in 2022.x
     
  13. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    482
    Oof, that's fast. Do we get 1.0 release in 2021.2 or it will be postponed to 2022.1?
     
  14. AlexandreT-unity

    AlexandreT-unity

    Unity Technologies

    Joined:
    Feb 1, 2018
    Posts:
    376
    The refactor of TextField will take place in 2022.x, there is not enough time left in 21.2.
     
  15. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Thanks for the update! :)
     
  16. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    One suggestion for the reimplementation; Make text fields behave more similar to how labels behave. Currently making a tool where I create text fields in C# and something as simple as removing the background color (which should be blank by default) required multiple layers of trickery with the chance of errors on each layer. Having them start out at an empty container (possibly with placeholder/default text) which can then be styled and edited would simplify things a lot.
     
    HugoBD-Unity likes this.
  17. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    If I may add a couple of more suggestions. Current TextField has lot of locket behaviour that can't be changed by a property:
    * All text currently gets selected/highlighted when the field is focused. It would be really nice if one could toggle this off
    * Cursor style can't be currently changed. If one changes the background color of the TextField, it would be helpful to make the cursor color more contrasty and also have the ability to make it thicker.
    * We can't access current caret position within the TextField (for example if we would want to add a dropdown at caret position, autocomplete of some kind).

    It would be so nice to have all this changable via a property and accessable in the TextField class.

    Our use case is to make a text editor field for Editor-use. The way we would want to make our TextField is that once user clicks anywhere within the TextField (currently not in focus), with this one click the following would happen:

    1) TextField gets focus without all text getting selected/highlighted
    2) caret would be immediately transported to the click position
    3) Once user would start typing, we would try to analyze latest word and render an autocomplete-dropdown using the caret coordinates.

    I know it's very special use case, but having this kind of stuff accessable (like caret position and focus behavior) from the class would be really helpful and it would be easier to extend the functionality when there aren't so many locked behaviour that can't be accessed from the outside.
     
    Nexer8 likes this.
  18. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    572
    The textFields (as all element ending in "field") are meant to be a field in an editor inspector : there is a label on the left side, and other small details that make it inline with the IMGUI component. As such, the styling, especially in the editor with the light or dark theme, need to be as it is. I think we need another component that will address more/different use case and potentially be used for the textFields. There is currently no way to select the text from a label for example, or to do an editable label using a double click and both would requires really different visuals compared to the textField

    I think you have listed interesting usages, and they will be shared with the team so that they are considered during the design.
     
    Nexer8 and JoNax97 like this.
  19. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Hi! Just wanted to inquire if there are some news or plans on this topic and especially the customizable text field element (or the new element to provide more customization)?
     
  20. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    498
    At the moment, our focus is still on the refactor of all InputFields to use TextCore, and we'll try to add as much customizability as possible (cursor color, caret position, highlighting...).

    No news about the new control, it's still on the drawing board.
     
    Nexer8 likes this.
  21. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Thanks for the update! :) This is great news!

    Also an incredible helper would be to be able to turn off auto-select-all-text-behavior upon field focus - currently all text is selected when a field is focused - desired alternative behavior would be to be able to just click anywhere on an unfocused field and the caret would be moved to that position directly without selecting any text. Currently we are using some focus hack that only works half of the time. Also some events for caret position change would be really nice!

    Is rich text support for TextField still on track for 2022 alphas/betas later this year?

     
    Last edited: Aug 27, 2021
  22. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    498
    This has been requested a few times, it will definitely be part of the refactor.

    Yes, it is, it's part of the ongoing refactor. Unfortunately, I doubt the refactor will be completed for 2022.1, but you can expect it to be completed for 2022.2.
     
  23. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    487
  24. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Having one of those UIToolkit days right now

    c01df5f583f3bf9e0ee6935a7f5f99a7.gif
     
    PrimalCoder and Suger_Ted like this.
  25. PeppeJ2

    PeppeJ2

    Joined:
    May 13, 2014
    Posts:
    43
    4 years later still not update. Can I expect this in 2030 at least?
     
    Unique-Player and ontrigger like this.