Jump to content

Text2D does not refresh its text


AlbertTJames
 Share

Recommended Posts

Hi,

 

I have a Text2D in a Rectangle2D, I change the text every 200ms but it does not refresh on the screen. Although when looking at the text property it changes properly. The text refreshes only if I set its levelVisible property on and off at each tic. 

I do not have this problem in the playground so I am not sure what is going on. 

   state.tic = function () { 
      const text = newText() // this works 
        state.tooltipPause.text.text = text

        // setting the parent rectangle2d levelVisible 
        // is the only way i have found to refresh the view
        state.tooltipPause.box.levelVisible = true  
        
        // delay is simply a promise that will resolve in 200ms
        delay(200).then(() => {
          state.tooltipPause.box.levelVisible = false
          state.tic()
        }) 
    }

 

 

Just sharing the little hack I found, in case someone else has the same problem

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...