Hi, I can’t seem to get my widget to replicate/display a variable or string. I have tried a few things but neither work. The widget is meant to get the Character’s Name and display it in my Widget, but fails to work however does cast.
-I have tried retrieving it:
–from the character
–from the widget blueprint itself, and,
–tried getting it directly as a Name, and String variable.
–Calling a function.
How du you get the variable in the Event Graph?
You can under the Details section of the text box, next to the name of the box, activate “Is Variable”.
The box is now showed as a variable in your event graph, and from there you can use a “Set text” node when dragging a pin out from this variable, and thus set the new text, getting the text variable how you see fit
I turned the “is variable” off to see if it WOULD make a difference, at first it was ‘on’. However your idea still does not seem to work.
This is how i would set it up. But for this to work, i would need to remove the “CharacterName++” variable it is assigned to in your picture.
If this doesn’t help, please upload an image of your blueprint setup, in how you get the variable, as i can’t see what the error might be in your setup.
Thank you that worked just fine, do you know why it does not directly show a text/string variable like that of an integer or float?
It is due to what data type it is stored as, and how they can be used.Let’s sat we have the number 21
An integer (or float) is a data type you can do math with (as in 21.5+20 will equal 41.5).
Textboxes only accepts texts (letter-characters) which doesnt have this function. So for a number to be recognized as text, it must convert the munber into the characters that is is made of, and tell it “Hey, you must behave like letters”.
So now, they are not being recognized as numbers that you can do math with, but insted like a character such as A,d, # and ?. So if you would add to Texts (or more precisely strings, which also consists of characters) as before you would get (21.5 + 20 equals 21.520) as in how you would lay words next to each other.
This, the textbox can understand, and translate to something it can show.
This process is what happen when you convert from integer/float to text/string.
Hope it makes sense
Yes thats some nerdy stuff and I like it! I understand how they are stored, however why does the text box fail to directly dispay a string/text variable that contains characters? It manages to display integers and floats. Surely ue4 designers would have empowered this.
(Or was my method inadequate, it works for getting digits, now that I understand this I can ensure numbers are displayed correctly by changing variable type, i.e. health to display 10, and not 10.0, thank you.)
I am not entirely sure what you mean then? Is it how to convert an int / float to be visible in a text box? Then you convert it to a string first, and then into a text immediately after.
I wanted to know why Ue4 has difficulties converting it directly into a text compared to using just an get initiger and convert to text function. (Thought I replied ages ago).
Hi! I am having lots of trouble on similar issue, as described here: https://answers.unrealengine.com/questions/1028014/view.html
Any help appreciated!