GUILayout: Placing images on top of each other

So what I’m trying to do is create 4 Textures overlap each other, so they have the same x and y position as well share a height and width. But I’m using GUILayout for screen resizing and placement issues that GUI just wasn’t solving. Here is a snippet of code…

GUILayout.BeginVertical();

GUILayout.Box(circleImageOne);
GUILayout.Box(circleImageTwo);
GUILayout.Box(circleImageThree);
GUILayout.Box(circleImageFour);

GUILayout.EndVertical();

So those Boxes I want to be overlapping each other in the same position on the screen. But I want to be able to place those boxes in a position on the screen using the GUILayout. I’m hoping for anyone that can give me some good alternatives, but please no one responding with telling me to switch over to GUI.DrawTexture. I know that I can do it with that, but I get sizing and spacing issues with the screen resizing itself if I do that.

I know this is an old thread, but you can use GUILayoutUtility.GetLastRect().

GUILayout.BeginVertical();
{
    GUILayout.Box(circleImageOne);
    GUI.Box( GUILayoutUtility.GetLastRect(), circleImageTwo);
    GUI.Box( GUILayoutUtility.GetLastRect(),circleImageThree);
    GUI.Box( GUILayoutUtility.GetLastRect(),circleImageFour);
}
GUILayout.EndVertical();

As no one has posted yet, I’ll just add my two cents. I don’t see why you need the GUILayout if you want them stacked… I think it’d be more ideal if you were to use the normal GUI.DrawTexture, stack them that way, and find work arounds to work with different resizes… GUILayout is for automatic layouting, not for putting things where you want them to be… Whether you just make the location the Screen.width/2 and Screen.height/2 or make the location simple 0,0 and then change the sizes to change with the Screen.width/Screen.height.

I just can’t see resizing being such an issue unless you’re making your screen small as no other… A general rule (In my opinion) is if it works in the Web View, you’re fine. That’s the smallest anyone will be going unless you’re developing for Android/iOS, which you could be, in that case, I’d still suggest finding a work around hah. But yeah. Good luck! (Look around the API/search Google, I’m sure someone has had this problem lol).

Hi, i think you can make the window no-resizable…not 100% sure though.