• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

248
Views
Can i remove this large space when using EditorGUILayout.PropertyField?

I'm getting into Editor Scripting in Unity and quickly get taken a back by this whole SerializedProperty thing. All i'm trying to do is make this Case Sensitive checkbox stick to the right of the inspector without all that space between the text and the box itself, leaving plenty of space for the TextField.

This is what i'm currently doing:

using (new EditorGUILayout.HorizontalScope())
{
    GUILayout.Label("Search for:", GUILayout.Width(64));
    searchText = GUILayout.TextField(searchText);
    EditorGUILayout.PropertyField(propCaseSensitive, GUILayout.MinWidth(0), GUILayout.ExpandWidth(false));
}

This is what i get

I've tried GUILayout.Width and GUILayout.MaxWidth and GUILayout.ExpandWidth(false) combined with GUILayout.MinWidth (and also just by them selves)

None of which have worked, i've been stuck trying to get this simple script to work for a bit too long for me to admit and it's driving me crazy. Please help me out, Thank you :)

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

I think you can do it similar to your other label.

PropertyField has an overload taking GUIContent label. By passing in GUIContent.none you omit the label and can instead add your own one:

                                                          // Not sure if even needed but adjust to the width you need
EditorGUILayout.LabelField(propCaseSensitive.displayName, GUILayout.Width(64), GUILayout.ExpandWidth(false));
                                                 // Don't draw the name via the default property field layout
EditorGUILayout.PropertyField(propCaseSensitive, GUIContent.none, GUILayout.ExpandWidth(false));
about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error