Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How do I place two images side-by-side in a custom inspector, fitted to current width?

Discussion in 'Editor & General Support' started by ashaik11, May 30, 2023.

  1. ashaik11

    ashaik11

    Joined:
    Jun 3, 2020
    Posts:
    6
    I'm trying to place two Textures side by side in a custom inspector. I'm currently placing them in a Horizontal layout like this:

    Code (CSharp):
    1. GUILayout.BeginHorizontal();
    2. GUILayout.Box(myScript.tex1);
    3. GUILayout.Box(myScript.tex2);
    4. GUILayout.EndHorizontal();
    However this renders the Texture really big, as shown in the attached image. If it matters the textures are 640x576 and 1920x1080, so I suspect it is trying to render them at the full resolution. How do I constrain this so that each texture takes up 50% of the current inspector width?
     

    Attached Files: