Legacy Documentation: Version 2018.2 (Go to current version)
LanguageEnglish
  • C#

EditorGUI.DrawPreviewTexture

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static void DrawPreviewTexture(Rect position, Texture image, Material mat = null, ScaleMode scaleMode = ScaleMode.StretchToFill, float imageAspect = 0, float mipLevel = -1);

Parameters

positionRectangle on the screen to draw the texture within.
image Texture to display.
matMaterial to be used when drawing the texture.
scaleModeHow to scale the image when the aspect ratio of it doesn't fit the aspect ratio to be drawn within.
imageAspectAspect ratio to use for the source image. If 0 (the default), the aspect ratio from the image is used.
mipLevelThe mip-level to sample. If negative, the texture is sampled normally. Sets material _Mip property.

Description

Draws the texture within a rectangle.

If mat is null (the default), an appropriate material will be chosen for a RGBM or doubleLDR lightmap or a normal map and the fallback blit material will be chosen otherwise.


Preview Texture in an Editor Window.

Did you find this page useful? Please give it a rating: