原创by superowner
测试代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test_01 : MonoBehaviour {
public UnityEngine.UI.Slider Slider;
public RectTransform Rect;
// Use this for initialization
void Start () {
Slider.onValueChanged.AddListener(Listener);
}
void Listener(float value)
{
Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, value*100);
}
}
网友评论