- Home /
EditorGUI.Slider positioning
I am working on an editor script and I want to put a slider in the middle of it, among other variables.
I would like to use EditorGUI.Slider but I have difficulties placing the slider properly.
Rect space = EditorGUILayout.BeginHorizontal(new GUILayoutOption[] {GUILayout.Height(50.0f)});
script.Val = EditorGUI.Slider(space, script.Val, 0, 100);
EditorGUILayout.EndHorizontal();
This will yield a slider but the slider doesn't have the correct height (the height paramater is ignored), can't be dragged (probably a separate issue). Unfortunately the Unity documnetation is not using the position parameter and it doesn't seem to be optional. Unity 4.6 Beta 19
Answer by steakpinball · Oct 01, 2014 at 05:03 PM
Use EditorGUILayout.Slider when using other EditorGUILayout
methods.
Generally, use EditorGUI
for property drawers and EditorGUILayout
for custom editors.
Your answer
Follow this Question
Related Questions
Editor Window Views 0 Answers
Print to status bar. 0 Answers
SceneView.onSceneGUIDelegate GUI sorting problem 1 Answer
Custom Editor - Is there any way to detect whether the user is in Prefab editing mode? 1 Answer
Cannot close Preview Scene 0 Answers