Announcement

Collapse
No announcement yet.

How do I mainipulate TextBlocks created from umg in c++ on unreal engine?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I mainipulate TextBlocks created from umg in c++ on unreal engine?

    I would like to be able to update a TextBlock made with blue print widgets and get weather or not it has been clicked using the back end c++ code. Is there anyway to do this currently?

    Click image for larger version

Name:	1df233bac9dd1aae91ce06a8f88b9982.png
Views:	68
Size:	230.1 KB
ID:	1720389
    As you can see here I have a bunch of TextBlocks overlayed on buttons and I would like to be able to change this text when the user presses a new key.

    #2
    Short answer:
    In your UUserWidget class inherited by your Blueprint:

    Code:
    UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
    UTextBlock *TextBlock0; // Same name as in Blueprint. Don't forget to check Is Variable next to its name.
    
    
    TextBlock0->SetText(/* FText() */);
    You just need to change UTextBlock to UButton to bind with buttons.


    Better answer:

    http://benhumphreys.ca/unreal/ui-cpp-uuserwidget/
    http://benhumphreys.ca/unreal/ui-bindwidget/
    Last edited by SolidSk; 02-12-2020, 10:54 PM.

    Comment


      #3
      Thank you so much, this helps a lot.

      Comment

      Working...
      X