What I want: Use icons (read bitmaps) within my Unity Editor Panel script so that I can display icon- instead text buttons.
What I am at: based on this board message: http://forum.unity3d.com/viewtopic.php?p=229676 I tried to replicate that but Unity crashes every time whenever I try it, I noticed also that often Unity doesn't really reload the script but caches it or just gets stuck.
Proof: Here is a screenshot of the project folder in Unity, booth icon png image and script are within the "Editor" folder.
This is the SoapEditor.cs script:
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Reflection;
using System;
public class SoapEditor : EditorWindow {
[MenuItem("Soap/Soap Editor #e")]//shift + e
static void Init() {
SoapEditor win = (SoapEditor)EditorWindow.GetWindowWithRect(typeof(SoapEditor),new Rect(0, 0, 120, 240),true);
}
void OnGUI() {
Texture2D tex = (Texture2D)EditorGUIUtility.Load("EditorIcons.png");
GUI.DrawTexture(new Rect(0, 0, 16, 16), tex);
}
}
Any working example would be nice, because I can't even starting working on my editor Interface because unity keeps crashing at this point and even deletes scenes because of inconsistent backups. Thanks in advance,
Hendrik