void updateValueByCurrentPos() { float cP = 0; if (direction == ControllerDirection.HORIZONTAL) { cP = handle.localPosition.x; } else if (direction == ControllerDirection.VERTICAL) { cP = handle.localPosition.y; } float newPos = (cP + halfDifPos) / coef; //print("handle.localPosition == " + handle.localPosition); //print("newPos == " + newPos); if (curValue != newPos) { float newFPos = curValue / (minMaxValues.y - minMaxValues.x); curValue = newPos + minMaxValues.x; //onChangeValue(); main.onSliderValueUpdate(name, curValue); } if (fillingBar != null) { Vector2 newScale = fillingBar.transform.localScale = fillingBarScaleCoef; } }