Overlay in a GUILayout

Hello,
I’ve created a custom scrollbar style that is big enough to accept text inside it.
That way, it can display something like that :

||########300/500###____||

Unfortunatly, you can’t add a GUIContent when you use GUI.HorizontalScrollbar( ) .

When I don’t use layout, it’s not a problem :

GUI.HorizontalScrollbar( _rect, 0, value, 0, maxValue );
GUI.Label( _rect, value + " / " + _maxValue );

It works fine.

But now, I’m creating a GUI where my scrollbar is inside a GUILayout.BeginScrollView( )
And I don’t know how to overlay two elements inside a GUILayout. :frowning:

Is it possible to insert some GUI elements inside a GUILayout?
I wish I could do something like that :

GUILayout.BeginScrollView( ... );
[...]
GUILayout.BeginStaticSpace( width, height )

  GUI.HorizontalScrollbar( _rect, 0, value, 0, maxValue );
  GUI.Label( _rect, value + " / " + _maxValue );

GUILayout.EndStaticSpace();
[...]
GUILayout.EndScrollView();

But BeginStaticSpace doesn’t exits :smile:
Is there something similar inside the toolkit ?
( or something totally different that enables to overlay some element inside a GUILayout ScrollView )

Thanks in advance.

Drawing using GUI.HorizontalScrollbar and GUI.Label places the controls using an exact rect, while drawing using GUILayout.HorizontalScrollbar and GUILayout.Label draws them using the layout system. Is that what you had in mind?

Yes.
When I am not inside a GUILayout area, I can put two GUI element at the same position.

GUI.HorizontalScrollbar( _rect, ...
GUI.Label( _rect, ...

But inside a GUILayout area, it seems not possible.
Some may say : “That’s the purpose of layout management…”

They will be right but…

Sometimes, you have some ScrollView with a text with upredictible height.
On those cases, I’m using a GUILayout.BeginScrollView( ) to be sure that all the text can be displayed.

And I just found that in one of my GUI If want a scrollbar after my text…
That means inside the Scrollview → So inside a layout area.

Inside this box, I can’t use the same trick for overlaying my label and the scrollbar.
I wish to know if there is a way to put two element at the same location inside a layout area.

Thanks in advance :slight_smile: