Skip to content

Instantly share code, notes, and snippets.

@PapeCoding
Last active March 9, 2020 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PapeCoding/44658cce9acf4980949a02b8ac741e68 to your computer and use it in GitHub Desktop.
Save PapeCoding/44658cce9acf4980949a02b8ac741e68 to your computer and use it in GitHub Desktop.
This shows how an UMG widget can be bound/controlled from C++
#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;
};
@PapeCoding
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment