Question by
jinoh · Mar 07, 2020 at 08:27 PM ·
texture2deditorwindow
texture2D.SetPixel() doesn't work properly
this is part of my custom editor window
void SetBackgroundColor() {
Rect r = new Rect(0, 0, position.width, position.height);
//create texture
Texture2D tex = new Texture2D(1, 1);
tex.SetPixel(0, 0, Color.black);
tex.Apply();
GUI.DrawTexture(r,tex);
}
and this works fine so my editor window turned black but problem is i want to set background color with my custom color so i changed "tex.SetPixel(0,0,Color.black) " to "tex.SetPixel(0,0,new Color(71,71,71) ) " then the code doesn't work ,i can't understand why this happen please someone help me
Comment
Your answer
Follow this Question
Related Questions
Switch Texture Type To Sprite. 0 Answers
OpenGL textures always show up black 0 Answers
How to draw a texture on another texture 0 Answers
How to get rgb from Texture2D faster? 0 Answers