using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class L5_8Demo : MonoBehaviour
{
public Slider slider;
void Start()
{
slider = GetComponent<Slider>(); // 获取Slider组件
slider.onValueChanged.AddListener(SliderOnValueChanged); //监听,
}
void SliderOnValueChanged(float va)
{
Debug.Log(va); // 输出滑块的值
}
}
Slider:Slider 组件
Background:Image组件(背景图)
Fill Area:填充区域
Fill:Image组件(填充物)
Handle Slider Area:触摸区域
Handle:Image组件(触摸物体实际图片)