- Home /
 
               Question by 
               YoungDeveloper · Sep 18, 2013 at 09:01 AM · 
                editorcolorbackgroundwindowcustom  
              
 
              Color custom editor window ?
Is there a way to color custom editor window, instead of default light-grey (not input fields), thanks!
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by ArkaneX · Sep 21, 2013 at 02:44 PM
I'm not 100% sure if that is what you wish, but you can simply draw a texture before all other GUI elements, like in code below (partially copied from one of your earlier questions):
 public class ScriptClassName : EditorWindow
 {
     private static Texture2D tex;
 
     [MenuItem("Tools/Something1")]
     private static void showManipulator()
     {
         EditorWindow.GetWindow<ScriptClassName>(false, "Something1");
 
         tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
         tex.SetPixel(0, 0, new Color(0.25f, 0.4f, 0.25f));
         tex.Apply();
     }
 
     void OnGUI()
     {
         GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), tex, ScaleMode.StretchToFill);
         GUI.Label(new Rect(200, 200, 100, 100), "A label");
         GUI.TextField(new Rect(20, 20, 70, 30), "");
     }
 }
Works like a charm, except tex stuff can also be in OnEnable() ? Because i had to close and relaunch the editor for it to change, which is not a big problem, but using OnEnable it sets it in scene :).
Yes - I put it after GetWindow just for making a quick test, but OnEnable is a good place for this initialization.
Answer by Tenebrous · Feb 13, 2014 at 11:30 AM
You could try this:
 GUI.color = whatever; 
 GUI.DrawTexture( yourrect, EditorGUIUtility.whiteTexture );
 
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                