Hello ArenMook,
I have encounter un problem with the slider thumb position.
The thumb position is not correctly set, if you change the value of the slider while the control scale is Zero. (see attachment)
To replicate it :
- Set the LocaleScale of the UISlider to 0,0,0
- Change the UISlider value
- Set the LocaleScale of the UISlider to 1,1,1
- The thumb is at the center and not at the value
Why am I setting the scale to 0 ? Because of some transition/animation purpose.
I dug in the code to see where the pb come from :
The SetThumbPosition of UIProgressBar use InverseTransformPoint to setup the position, which is affected by the scale.
But I think that the scale of a widget should not affect his behaviour..
protected void SetThumbPosition (Vector3 worldPos)
{
Transform t = thumb.parent;
if (t != null)
{
worldPos = t.InverseTransformPoint(worldPos);
worldPos.x = Mathf.Round(worldPos.x);
worldPos.y = Mathf.Round(worldPos.y);
worldPos.z = 0f;
if (Vector3.Distance(thumb.localPosition, worldPos) > 0.001f)
thumb.localPosition = worldPos;
}
else if (Vector3.Distance(thumb.position, worldPos) > 0.00001f)
thumb.position = worldPos;
}
Decco