Last active
July 5, 2018 14:15
-
-
Save rob5300/64696f1a8411155ed9034ace0196deb1 to your computer and use it in GitHub Desktop.
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