Adding Buttons and Text fields to UE4 Plugin
I'm new to UE4 plugins and I would like to add buttons and text fields into my "StandAlone Window" plugin in C++ that I have created for my project. I haven't found any useful information on the internet for implementing buttons and text fields for plugins in C++. I read the UE4 plugins documentation, but the documentation doesn't teach how to implement those kinds of things like buttons, text fields or icons inside the "StandAlone Window" plugin. Any help would be appreciated.
asked Apr 17 '19 at 12:44 PM in C++ Programming
First of all plugins are not some special code, enigne is build out of modules which can be dynamically loaded or build monoliticly similar fusion as Linux kernel. When you make C++, you creating extra module that will be added to the engine, plugin is no diffrent from that, only diffrence is you can attach extra modules (btw UE4 project can also have multiple modules) to any project. So essentially regardless where you write C++ code in UE4 you always extending engine code and it the same as you would add code to UE4 source code
That why instead of searching "Adding X thing to plugin" you should search those individual actions, like "Extending editor", or "Adding to editor"
But on topic at hand, if oyu think of doing any UI to the engine you should learn Slate first. Slate is UI system of UE4 originally made for editor in 4.0, but it can be used in games.... yes, UMG is just blueprint frontend for Slate. And it also means, if you familiar with UMG you should already have understanding how Slate UI works, you just need to learn how to use it in C++. You can read about it here:
If you learn this, you also will be able to make your own UMG widgets from C++, so learning Slate is actully next deep step in to advance use of UMG ;] Slate widget selection is actully bigger then UMGs as not all Slate widgets are exposed. Of Slate widgets orginalte from SWidget class, same as UMG widgets (which are shells for Slate widgets) are orginating from UWidget
And same as UMG, you make UI by making you own widget that can be reused. So you got option either create your own SCompoundWidget which will let you to reuse it or or or direly declare UI with nested SNew composition.
Now in to actually extending editor, the best way to do it is via extenders, as those allows to inject higns in to existing editor UI. Tehre very old tutorial which is still quite valid showing the basics:
It also shows Widget Reflector (Window->Devlopment Tools->WidgetReflector) which allows you to see slate widget tree of editor and inspect editor UI. With that you can see editor UI is made and by looking specific compound widgets names in engine source code, you can actually see how they are made (remeber plugin is no different from module in engine source code, you can do exact same things that those modules does)
Also there some templates in plugin wizard, you might check it out
As for making window you need to make SWindow and then you can add it with FSlateApplication::Get()->AddWindow() and you can do a lot more things from FSlateApplication::Get()
answered Apr 17 '19 at 10:58 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here