Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[SOLVED] Custom inspector too tall causes horizontal scrollbar?

Discussion in 'Extensions & OnGUI' started by toastertub, Dec 2, 2018.

  1. toastertub

    toastertub

    Joined:
    Oct 28, 2013
    Posts:
    13
    Hello all.

    While working on a custom inspector, if I have too many options and it makes the inspector taller than my screen, It stretches the inspector. It about doubles the width and puts a horizontal scroll bar at the bottom.


    If I hide some options, it doesn't matter what ones, just as long as the inspector is shorter than my monitor, then it's all fine.
    Not Stetchy.png


    But if I show more options and the inspector gets too tall, it stretches the whole thing, it even stretches out the other components.

    stretchy inspector.png


    I've been messing with this for a few hours, trying to find what I did wrong in my code, but it doesn't seem to matter what options I show or hide, it just depends on the height of the inspector.

    Does anyone know what to do with this, or has anyone fixed this before?

    It's causing my ScrollViews to stretch off of the screen, no matter what size I give them as GUILayout.Width it just ignores it while the inspector is stretching.
     
  2. toastertub

    toastertub

    Joined:
    Oct 28, 2013
    Posts:
    13
    I seem to have found it. In some areas I had used GUILayout.width() on buttons inside of a GUILayout horizontal area, and taking those out is the only thing that fixed it. It seems I can do anything else inside of a horizontal layout area.