Created
September 20, 2018 02:30
-
-
Save nabesi777/eb11e302a7035371e82ec1f513d389f2 to your computer and use it in GitHub Desktop.
Slider Unity&C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Slidebers : MonoBehaviour | |
{ | |
private float hSliderValue = 0.0f; //平行スライドバーvalue | |
private float vSliderValue = 0.0f; //垂直スライドバーvalue | |
// Use this for initialization | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
void OnGUI() | |
{ //横スクロールの(X座標、Y座標、Xサイズ、Yサイズ) | |
hSliderValue = GUI.HorizontalSlider(new Rect(350, 330, 200, 30), hSliderValue, 0.0f, 10.0f);//スクロール範囲の最小値・最大値 | |
//縦スクロールの(X座標、Y座標、Xサイズ、Yサイズ) | |
vSliderValue = GUI.VerticalSlider(new Rect(600, 360, 30, 100), vSliderValue, | |
10.0f, 0.0f);//スクロール範囲の最小値・最大値 | |
//スクロール範囲値の表示 | |
GUI.Box(new Rect(350, 360, 100, 100), hSliderValue.ToString()); | |
GUI.Box(new Rect(480, 360, 100, 100), vSliderValue.ToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment