Example for using GUILayoutUtility to draw a texture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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