- Home /
EditorGUILayout is cutting off my Toggle label
I'm creating a toggle button with 'EditorGUILayout.Toggle("25 character string here", myBooleanValue);' . Unfortunately, my 25 character string is getting cut off, so all you can see is 'string here'. Which is really weird, because there's plenty of room in the inspector(take a look at the screenshot). I've tried passing in GUILayout.Width(Screen.width) and GUILayout.ExpandWidth(true), but neither of these seem to have any effect. What's happening here? (It seems as though I'm just making some stupid mistake, since I haven't been able to find this question anywhere else)
You'll have a bigger chance of a succesful answer if you'd add the code you're using
Answer by Nicholas Francis · Oct 25, 2009 at 05:33 AM
Could you paste the code you're using?
Hello, The code for the first toggle button is shown below:
thrusters[cnt].forceLift = EditorGUILayout.Toggle("Apply Lift Force", thrusters[cnt].forceLift);
You're looking for EditorGUIUtility.LookLikeControls - it takes a parameter, labelWidth which is the width of all labels
Answer by Ranza · Oct 26, 2009 at 08:43 AM
Maybe try using EditorGUI.Toggle and pass it a desired Rectangle - it's much easier to control sometimes
I actually tried that, but when using EditorGUI, the y coordinate starts at the top of the entire Unity Inspector. So I would have to calculate the distance from the top of the inspector to where my inspector starts, and then from there calculate where the button should be placed. And given that I will be expanding and closing other component inspectors, the distance from the top of the inspector to the top of my inspector will vary.
Your answer
Follow this Question
Related Questions
GUILayout not working with Event.Use (Unity 4.0) 0 Answers
Editor GUILayout.ScrollView not scrolling when typing 1 Answer
(Solution) - Can't use GUILayout stuff in PropertyDrawer.OnGUI? 2 Answers
GUI Layout During Gizmo Painting In The Editor 0 Answers
Replace ordinary array with a fancy dynamic texture pack array. 0 Answers