Claire
Claire

Reputation: 109

How to change text in textblock from onclick button event in UE5?

I am new to Unreal Engine. Currently I am learning UE5. I am trying to change text and I had run into problem. And somehow I can't find any information about it.

I simply created user widget, I put a button and a text block. So the question is how can I change text in text block using onclick button event?

Upvotes: 0

Views: 5750

Answers (2)

Wappenull
Wappenull

Reputation: 1389

Additional note to this

For beginners, sometimes SetText will not show due to "Context Sensitive" is ticked (by default) enter image description here

So you need to uncheck the box and make sure to select correct type of SetText with correct target widget type.

enter image description here

Upvotes: 1

Claire
Claire

Reputation: 109

I found the solution. It was easier than I thought. enter image description here

  1. First mark your text as variable. Then literally [Get] it in ur bp.
  2. Get a branch [set 'name'] from your text (I my case Head Txt).
  3. Then from Set set a branch [SetText] and type ur text.

That's it! Can't believe I spent so many time trying to find the solution in blueprint videos, but accidently found out how to do this from C++ code.

Upvotes: 1

Related Questions