So i just started with UMG and after a week of messing around with it.
I wanted to extend the Widget Blueprint, i got some great help from so thanks again.
Disclaimer
This was done in UE 4.4.2 as UMG is experimental and may change this solution may change/ “break” in future versions.
UPDATED VERSION CAN BE FOUND
In order to derive my class from UUserWidget:: i did the following.
1 Header Files:
Added several headers to my project header. “(YourProjectName.h)”.
3 Compile
Compile and re-open the editor.
And add a new class to the project derived from UUserWidget::
If you where wondering how the header of the derived class looks like after created/ added from the editor.
#pragma once
#include "Blueprint/UserWidget.h"
#include "InventoryWidget.generated.h"
/**
*
*/
UCLASS()
class MYGAME_API UInventoryWidget : public UUserWidget
{
GENERATED_UCLASS_BODY()
};
4 Using the new User Widget class.
Create a new Widget Blueprint
5 Set the Widget Parent
Open up the new Widget you just created and go to the Graph of the Widget Blueprint.
Press on the
button on the top of the window.
6 Go down to the details.
Under the Category “Globals” you set the class you derived from UUserWidget.
You are done, now you have a simple and fast way to extend the user widget.
From everything from Data Storage to picking up “events” delegates and so on.
Hey glad you liked it :).
I have been meaning to read up on the “How to” on the Wiki for adding new pages.
I will try get it done this weekend.
Cheers.
I followed the described Steps and also checked the wiki, but this seems to not work anymore in 4.6.1
Is this already known? or (may be) it’s just a Mac thing…
In Addition, also It did not help, but I suppose it is important to explicitly set the UCLASS Specifiers to get the wanted behavior also in the subclass:
UCLASS(Abstract, editinlinenew, BlueprintType, Blueprintable, meta=( Category=“IngameUI” ))
class UIngameUIWidget : public UUserWidget, public IIngameUICanvasChild
The problem is: Also my code compiles fine, I cannot select my class to reparent a newly created UMG Widget.
Any advises on this?
Hmm i will be going over the Wiki entry and update it over the weekend.
I see some have had some small issues before and its become a bit simpler with extending user widget as well.
Give me the weekend and i have a updated version for you.
Not sure way you can`t set it to parent,
but if the class is Abstract dont you need to use a derived class for BP/ Widget Parent class?
Glad it was helpfull, this has actualy got a lot simpler since i did it last.
So i made a new Wiki Entry for it, as i did not want to remove the old tutorial all together.
I’d say you saved my day, but it’s more like you saved my month. Thanks a lot for taking the time to write this and the tutorial in the wiki! Now I know blueprint classes can be reparented, which is useful in other cases too.
I realize this topic is old, but how would I go about writing a function that’d pass UMG elements (which I understand are just Slate elements?) into a C++ Function/Event for processing there before updating back to the Blueprint?
Assuming I understand this correctly, I’m trying to make a function that takes a SGridPanel as input (which is a UniformGridPanel in UMG?) so I can refresh it’s slots before pushing it back out to the blueprint.