Announcement

Collapse
No announcement yet.

Multi-colored text string (UMG?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multi-colored text string (UMG?)

    I'm trying to build text strings with certain words colored differently in the middle of them. For example, the way N64 games used to be so fond of indicating relevant objects ("If only someone could help me find 3 GOLDEN TICKETS, I could get out of here!" with Golden Tickets in yellow) or how the Tony Hawk games would color special moves gold and gaps blue in your combo/move readout.

    Now, I know that I COULD do this by breaking the text element into multiple text elements and adding the coloration to them individually... But the problem is, when trying to display text in UMG, using stuff like text assigned to line-wrap automatically inside a single canvas space requires a SINGLE text variable, rather than an arbitrary number.

    So is there a way I can apply formatting to text variables? Or a way to combine multiple text variables for display in a single UMG text box in an arbitrary way (i.e. they scroll and line break as if they were a single text entry)?

    #2
    There is in Slate, it's called the SRichTextBlock, it's an extremely complex widget compared to the others. Which is why it hasn't been wrapped yet. You could make a very simple version yourself, just wrap it in a UWidget, and make the necessary decorator that supports the coloring you're looking for, and just expose a text property that you can fill with your formatted text.

    Comment


      #3
      Now when you say "wrap it in a UWidget", I hear "use C++". Is that basically the gist of it?

      Comment


        #4
        Yup, that's the gist.

        Comment


          #5
          I'm sorry to dig this up, but is it possible to do this from the UMG editor now, or is it still purely a C++ thing?

          Comment


            #6
            Originally posted by krides View Post
            I'm sorry to dig this up, but is it possible to do this from the UMG editor now, or is it still purely a C++ thing?
            There's an experimental and unfinished wrapper for SRichTextBlock in 4.8 that you need to unlock with C++.

            Comment


              #7
              Hi,

              Sorry to dig this up but I'm seing that it is still experimental in 4.9. Any date when this will be released?
              Is there any workaround until then?

              Comment


                #8
                Nope, it's not on the priority list right now. There are some terrible workarounds I wont recommend. I'd recommend copying the relevant bits in 4.9 into your own C++ project removing the experimental flag and tweak it to get the support what you need. Out of the box it can do simple color changes.

                Comment


                  #9
                  Thanks for the feedback.

                  Is there a way for us to raise the community interest for this?

                  Until then, I may add a container with textblock in it to manage 1 color per message with a limit of 20/30 text to avoid performance drops.
                  I will also look at the experimental widget to see if it can meet my needs.

                  Do we have some status of what's work / not work?
                  Does adding images is working?

                  Comment


                    #10
                    Is something like this considered "a terrible method"?

                    Multiples text block in a wrap box. Of course supposed to be dynamically updated.

                    Click image for larger version

Name:	multicoloredtext.jpg
Views:	1
Size:	306.7 KB
ID:	1103312


                    EDIT: Really not easy to manipulate actually =/
                    Last edited by Yun-Kun; 03-26-2016, 05:13 PM.
                    [Released] Multiplayer Combat Editor
                    A-RPG Sacred Swords
                    Auto-Chess Live Development
                    Youtube Tutorials

                    Comment


                      #11
                      Real terrible, performance, matainability. All bad. Forget dynamically modifying it from an external data source.

                      Comment


                        #12
                        I'll try and get it usable in 4.12. If you have any C++ skills at all, using the SRichTextBlock is the best way, and making a dedicated wrapper for one isn't that hard that works for your team. Making an extensible one is a pain, which is what's holding up the one I want to make for UMG.

                        Comment


                          #13
                          In the marketplace is a version which costs 10€, but I also made a cheap port from the SRichText to UMG. If you want, I can pack it into a plugin and put it for download, since you need to compile the engine from source or create a clone of the files yourself.
                          Hobby game developer from Germany Follow me on Twitter!
                          Stuff I made:
                          Steam Workshop Tutorial/Wiki
                          Making a full working translation for your game and change it at runtime

                          Comment


                            #14
                            I decided to make it into a quick plugin so people can use it before Nick has officially finished it (Hope thats ok): https://forums.unrealengine.com/show...763#post500763
                            Hobby game developer from Germany Follow me on Twitter!
                            Stuff I made:
                            Steam Workshop Tutorial/Wiki
                            Making a full working translation for your game and change it at runtime

                            Comment


                              #15
                              Glad this is being addressed soon, and thanks for the plugin!
                              Map Generator 1.0
                              Map Generator 2.0
                              Map Generator 3.0

                              Comment

                              Working...
                              X