Simply trying to bind text in a widget. I’m thinking this is a bug as it is so very simple but is not working. I can pass the integer directly to the return which works but if I try to get (even a specific number) from an array and return the text… it is blank in game. No errors. Using version 5.4
What’s the result of the -1?
Ah, I see it. It’s not a bug (or something that will get fixed) - never query widgets for data - it’s unreliable. They have their own delegates, in case of the slider it spits out values during onValueChanged
, use that. As a bonus, it only runs when you slide it, rather than 120 times per second for the rest of the application life.
Also, to make it neater:
You mean like this? From within the widgets event graph
Still is blank, I fear i’ve misunderstood sorry
I know you say not to query the widget for data but its the widget that has the data I need?
My slider has a range from 1 to 12, i want to get that number, truncate it and use that to pick the text from the array to show what month the slider is in relation to. Hope that makes sense
Try it like this:
- what is crossed out on the right is something to be avoided. The delegate (event node) already knows the value, no need to ask the slider again.
- same goes for what’s crossed out on the left, no need to set slider’s value - it’s already set by you moving the slider’s handle
My slider has a range from 1 to 12, i want to get that number, truncate it and use that to pick the text from the array
Precisely! It should boil down to:
Hmmm it still doesnt work for some reason.
The red line above will not return anything.
The green line above returns the integer just fine.
Somehow that array and the text within it will not feed through
Edit: Just to clarify, the array does contain text:
Print what the slider is producing, what do you get? Also, ensure you do not have a function binding for the text block as it will override everything - your original 2nd screenshot. This function needs to be cleared from the text block. This is, most likely, the culprit, it’s polling data every frame.
When i print, nothing shows. The binding is cleared too. It’s a total mystery. It was code from an old project that worked which is why i originally thought it was a 5.4 bug. It just isn’t returning anything from the array I’ve also checked the reference to make sure it isn’t getting overridden anywhere else too
Could you show the final script that you have?