Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Pojo226

Pages: [1]
1
NGUI 3 Support / Re: UILabels don't update during WWW call
« on: September 27, 2013, 02:07:04 PM »
Sorry- I did have the text assignment how you said. I was quickly mashing together some copy + pastes and that got screwed up.

After I import the file, I can update the label just fine in the same coroutine (separated by WaitForEndOfFrame's). In the while loop I can get the progress bar to update, but only when trying to update the text field with it Unity freezes until the import is completed.

2
NGUI 3 Support / UILabels don't update during WWW call
« on: September 27, 2013, 12:50:27 PM »
Hello,

I'm trying to use a progress bar (UISlider) with a text label (UILabel) to show progress during a coroutined WWW import. If I don't try to update the label, the progress bar and debug statements update as the data loads, but while trying to update the label, it freezes everything until the import is done. My guess is that the progress bar updates as it is just affecting the scale of the foreground element, while the text actually needs to be calculated. I've tried calling the label's update geometry (inherited from UIWidget) but that didn't work. I assume that the geometry itself is received during the panel's draw call?

If anyone has advice for this, or if I'm just going about it completely wrong, all feedback is welcomed.

And if anyone would like a look at code, here's a small bit of the first part. I modified UISlider to have a UILabel variable so I could modify associated text through progress bars:

  1. using(WWW import = new WWW("file://" + pathToFile)){
  2.         while(!import.isDone){
  3.                 progressBar.sliderValue = import.progress;
  4.                 progressBar.textField.text("LOADING " + import.progress / import.size + "/" + import.size);
  5.                 progressBar.textField.UpdateGeometry(progressBar.textField.panel, true);
  6.                 Debug.Log("Import: " + import.progress);
  7.                 yield return new WaitForEndOfFrame();
  8.         }
  9. }

Pages: [1]