Closed Mmarzex closed 11 years ago
UI elements don't change unless their refresh
method is called, because they are often expensive to build and don't usually change. So after you set the text, call the refresh method.
Okay, I'll try that. Would it be more efficient to use like say EntityText for something that will be changing more often? And if I were to use EntityText how would it follow the player like the UI box does?
EntityText is a UI element with a few property changes, but it is still basically a UIText element. You can use moveTo(myPlayer)
but I'd recommend using the UIText.
Alright, I just wasn't sure. Now I call the refresh() method on my UIText element but the score text displayed doesn't update but it does change if I bring it up in the console. Is there something else I am missing?
nevermind, I got it working, put it in the wrong update loop.
To be honest, I should probably add a check in the UIText to automatically update when the text has changed. I'll put it on the todo list for r6.
In latest dev (r6) UIText auto updates when the text property is changed so you no longer need to call refresh()
.
Currently I spawn a UITextbox with my player for score keeping. I set the text to 'score: 0' and then in the player update I want to change the text I did
That doesn't change the text. I noticed that if I go into the console when running the game and set myuiBox.text to something else it doesn't change but if I do myuiBox.textsettings.text then it does change but not on screen just in the console. Is there someway to do this?