Thanks for making this plugin.
It worked perfectly in the editor (4.11). However, I couldn’t get it to work in any kind of packaged build (it is not appearing at all, no error messages).
The project is c++.
I already Generated Visual Studio project files and built it from Visual Studio.
Right after I dropped the plugin in the project’s folder and opened the uproject, it asked me to build the plugin and I did - it worked fine.
There are some problems with this plugin like it is: I installed it, everything worked, but on editor restart, the editor shows errors that Rich Text Box script is not found. When I went to my HUD blueprint - all text was gone! Also, as it was noted above, plugin is not displayed in the packaged build (I actually could see errors in the logs while packaging that something related to URichTextBox is not found). I tried to add a reference in build.cs file, but it did not help, in fact, I was getting other errors, and on editor restart it could not open my project at all…
So, this is how I finally made it work (4.13 preview 2, it also works in a packaged build, and on editor restart):
(My base project is C++)
Do not use the plugin like it is. Instead, create a new C++ class RichTextBox inherited from Widget.
Copy everything from plugin’s RichTextBox.h/.cpp to our RichTextBox.h/.cpp
When I first seen this thread I thought this was exactly what I was looking for. I got it added to my project and it works fine.
When I started looking into the RichTextBox code I first thought adding images would be as simple as adding an ImageDecorator to the list of Decorators for the widget.
Unfortunately it seems a little more involved and I can’t quite wrap my head around how to add ImageDecorator support to the RichTextBox class.
Added shadows back in (though they don’t seem to work with <span> text)
Fixed depreciation errors
Reordered/renamed some things to make it more similar to the normal TextBlock
Also as @Flash7 pointed out, you can just put these files directly into your project and change the class API/header to your project, much easier than dealing with a plugin. (I couldn’t get the plugin working)
Edit: I looked deeper into the RichText code and it seems to only support these tags: Span, Size, Style, Color, and Font. So sorry for those who wanted inline images, looks like they’re not supported in any way.
Also it seems like RichTextBlock doesn’t support changing color at runtime. Any ideas on how to solve this?
Sure it is easier to use those files in the project, but I made the plugin mostly so Blueprint-only users can have the RichTextBlock
About the Images, I’m pretty sure that there’s a way of implementing images between text. Have a look on the Slate Test Suite (available at the developer tools), there they did it. Unfortunatelly I don’t have time - again - to mess with it, but have a look at STestSuite.cpp (Engine/Source/Runtime/AppFramework/Private/Widgets/Testing/STestSuite.cpp), thats where they implemented all the tests.
About the line breaks, in UMG try to hit Shift+Enter, that should add a new line. If you want to do that from blueprints, you probably need to append the string/text with a Shift+Enter in a text input field Kind of hacky, but it works!
@iUltimateLP! do you have any new version about this UMG Rich Text Box?I make a c++ code type based this plagin,but when i try to add a hyperlink func,i jamed…i saw the multi-colored function is implemented by SRichTextBlock,just call “SetText"func and get a FString with stardand color code like “<span color=”#ffffffff”>Text</>",but i can’t find how/where to analysis"span color=",and don’t know how to add a hyperlink decorative words…
I find STestSuite file,but is a little difficulty to my c++ skill… PS:i’m using 4.14