Skip to content

Instantly share code, notes, and snippets.

@rob5300
Last active July 5, 2018 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rob5300/64696f1a8411155ed9034ace0196deb1 to your computer and use it in GitHub Desktop.
Save rob5300/64696f1a8411155ed9034ace0196deb1 to your computer and use it in GitHub Desktop.
Example for using GUILayoutUtility to draw a texture
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(MyMono))]
public class EntityInspector : Editor {
public override void OnInspectorGUI()
{
MyMono mono = (MyMono)target;
DrawDefaultInspector();
EditorGUILayout.LabelField("Item Icon: ");
Rect rect = GUILayoutUtility.GetRect(100, 100);
EditorGUI.DrawTextureTransparent(rect, mono.texture, ScaleMode.ScaleToFit);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment