How do you resize texture displayed on inspector (GUILayout)?

Hi. I tried to figure out how to resize texture when it displayed on inspector. The method I found could only set the max size of the texture displayed but I cannot figure out how to set the minimum size for texture displayed on inspector.

For bigger texture they will be displayed smaller to fit the layout group. While for smaller texture they remained the same size. Is there a way to display the smaller texture bigger?

Here’s my script:

GUILayout.BeginVertical(GUILayout.Width(50), GUILayout.Height(50));
GUILayout.Box(texture, GUILayout.Width(50), GUILayout.Height(50), GUILayout.MinWidth(50), GUILayout.MinHeight(50));

Try using EditorGUI.DrawPreviewTexture instead, which takes a ScaleMode

You need to supply the rect, which you can get using

or

1 Like

Another option you could try would be to create a new GUIStyle from the Box Style and enabled StretchWidth and StretchHeight. That might work.