- Home /
Using the Horizontal Slider to Control a Plane's Y transform Variable
As the title states, I'm currently using the Horizontal Slider code and what I want it to do is be able to control a Plane's y transform variable.
My Plane is currently taged as Plane
var hSliderValue : float = 0.0;
function OnGUI () {
hSliderValue = GUILayout.HorizontalSlider (hSliderValue, 0.0, 10.0);
GUILayout.Label("Vertial Plane Transform");
}
Comment
Answer by DaveA · Apr 02, 2013 at 12:09 AM
Add this:
var myPlane : Transform;
function Start()
{
myPlane = GameObject.FindObjectWithTag("Plane").transform;
}
function Update()
{
var p = myPlane.position;
p.y = hSliderValue;
myPlane.position = p;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613095513im_/https://answers.unity.com/themes/thub/images/avi.jpg)