Slider.normalizedValue

切换到手册
public float normalizedValue ;

描述

滑动条的当前值,标准化为介于 0 和 1 之间的一个值。

using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.

public class Example : MonoBehaviour { public Slider mainSlider;

//Set to invoke when "OnValueChanged" method is called. void CheckNormalisedValue() { //Displays the normalised value of the slider everytime the value changes. Debug.Log(mainSlider.normalizedValue); } }