Author Topic: Bug in UIProgressBar: Possible for it to never update under normal circumstances  (Read 2789 times)

nyxojaele

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UIProgressBar.set_value() has an optimization in it where it won't perform any update logic if the change between the previous value and the new value is too small. However if every change you ever make is "too small", the progress bar will never update, ever.

Reproduce by taking a default progressbar, and creating a loop that takes about 5000-10000 iterations to linearly interpolate the progressbar's value from 0 to 1. It will never change.

Workaround (I don't believe this should be necessary!):
Call ForceUpdate() manually on the progressbar after changing it's value, which isn't fabulous because it completely obliterates the optimization mentioned above.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
In what version of NGUI? There was a bug here maybe 5 months ago that has long since been fixed to my knowledge. Right now there is an inequality check, a simple !=.

nyxojaele

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
According to the readme, it's 3.5.3

There is an inequality check, but then later there is something similar to a floating point epsilon check, looking for a minimum change. I'd post the source code where the issue is, but I don't want to post your source without permission.

Basically what I'm seeing in the source code is an inequality check against the current value, and if they're inequal, it basically checks if this.value (note that this does some rounding for the steps, which I'm assuming is why this optimization exists..) has changed by more than 0.001f. If it hasn't, it doesn't update.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Yeah you have an old version that still has that bug. Please update, you're many months out of date.