- Home /
GUI.Label background not working since 4.5 upgrade
Since I upgraded Unity 4.5 I don't see background texture for the code
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
texture.SetPixel(0, 0, new Color(0.3f, 0.3f, 0.3f, 0.5f));
texture.Apply();
_style = new GUIStyle { fontSize = 12, normal = new GUIStyleState { textColor = Color.green, background = texture } };
_position = new Rect(10, 10, 100, 100);
void OnGUI()
{
if(Event.current.type != EventType.Repaint) return;
GUI.depth = 0;
GUI.Label(_position, _content.text, _style);
}
What might be wrong?
Comment
Answer by vladibo · Jun 28, 2014 at 10:04 PM
OK it was my bad I just called Resources.UnloadUnusedAssets(); after creating the texture. Sorry for the question.
Your answer
![](https://koobas.hobune.stream/wayback/20220613152747im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problem Image GUI 2 Answers
How do I take maximum screenspace for Gui 1 Answer
GUIStyle returning error (error inside) 1 Answer
How Do I Center A GUI Label? 5 Answers