Search Unity

  1. Unity 2019.1 is now released.
    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:
    21
    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:
    21
    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.