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 - nyxojaele

Pages: [1]
1
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.

2
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.

3
NGUI 3 Support / Bug in UISlider: Jumps on first drag
« on: April 09, 2014, 10:49:21 PM »
I have a UISlider setup with an initial value of 0.5 in the inspector. When I run my project and attempt to drag the thumb, it will immediately jump all the way to a value of 1.0, and stay there until I let go of the mouse button. All attempts to drag the thumb after this point work perfectly fine.

I looked into the code, and I can see where things are going wrong:
UISlider.OnPressForeground() calls ScreenToValue(), which internally references UIProgressBar.cachedCamera. On the first time ONLY, cachedCamera will fail to find a UI camera, and end up using Camera.main.
By the time execution gets to UISlider.OnDragForeground(), which calls ScreenToValue() again, UIProgressBar.cachedCamera now correctly finds the UI camera it's supposed to use.

Again, all subsequent calls to both methods will always find the UI camera, so they always work correctly, it's just the first call to UISlider.OnPressForeground() that causes the issue.

EDIT: The problem was that the GO with the UISlider on it was on the wrong layer-- everything else in the UI was on the correct layer. So now I'm confused as to why it ever started worked at all!

Pages: [1]