Version: 2021.3

GUISkin.horizontalSlider

切换到手册
public GUIStyle horizontalSlider ;

描述

GUI.HorizontalSlider 控件的背景部分默认使用的样式。

padding 属性用于确定可在其中拖动滑块的区域的大小。

using UnityEngine;

public class Example : MonoBehaviour { // Modifies only the horizontal slider style of the current GUISkin

float hSliderValue = 0.0f; GUIStyle style;

void OnGUI() { GUI.skin.horizontalSlider = style; hSliderValue = GUILayout.HorizontalSlider(hSliderValue, 0.0f, 10.0f); } }