这里来讲解下UGUI 滑动条(Slider)的用法

Unity3D 之UGUI 滑动条(Slider)

控件下面有三个游戏对象

Background -->背景

Fill Area --> 前景区域

Handle Slide Area --> 滑动条

Slider的属性

Unity3D 之UGUI 滑动条(Slider)

其他几个设置和其他控件都差不多,这里来讲解几个特有的属性。

Direction -->方向

Whole Numbers -->控制整数输入

然后来看下脚本控制。这里的方法调用和其他的不用,方法里面有浮点参数

using UnityEngine;
using System.Collections;

public class SilderTest : MonoBehaviour {

    // Use this for initialization
    void Start () {
    
    }
    
    // Update is called once per frame
    void Update () {
    
    }
    public void SliderTest(float even) {
        Debug.LogError("您的血量=" +even );
    }
}

然后通过绑定脚本,能够在改变滑动条的值的时候,调用方法。

Unity3D 之UGUI 滑动条(Slider)

相关文章:

  • 2021-11-14
  • 2022-01-05
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-12-11
猜你喜欢
  • 2021-10-23
  • 2021-09-22
  • 2021-04-19
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
相关资源
相似解决方案