Last active
March 9, 2020 16:08
-
-
Save PapeCoding/44658cce9acf4980949a02b8ac741e68 to your computer and use it in GitHub Desktop.
This shows how an UMG widget can be bound/controlled from C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "CoreMinimal.h" | |
#include "Blueprint/UserWidget.h" | |
#include "TextBlock.h" | |
#include "Border.h" | |
#include "MySpecificUserWidget.generated.h" | |
/** | |
* | |
*/ | |
UCLASS() | |
class UMySpecificUserWidget : public UUserWidget | |
{ | |
GENERATED_BODY() | |
public: | |
//These declarations are magically bound to the UMG blueprints elements, | |
//if they are named the same. Also they need to be checked as "variable" | |
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) | |
UTextBlock* CornerText; | |
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) | |
UBorder* BlackBox; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you to http://benhumphreys.ca/unreal/ui-bindwidget/ on whos basis this code is written.
This can be used with https://gist.github.com/PapeCoding/df0e1619fc2911efcafff8375bdbb202