Im trying to create a sort of dialog window, which should have an image as background. I have tried using GUIContent, but cant make it work:
public Texture2D backg;
void OnGUI() {
if (render) {
GUIStyle style = new GUIStyle();
GUIContent bg = new GUIContent();
style.alignment = TextAnchor.UpperLeft;
style.normal.textColor = Color.white;
style.fontSize = 14;
style.fontStyle = FontStyle.Bold;
bg.image = backg;
bg.text = NPCline;
GUI.BeginGroup(new Rect(2, Screen.height-300, Screen.width-2, Screen.height-2), bg, style);
var i = 0;
foreach (var line in choices) {
if (GUI.Button(new Rect(10,60+i*40,Screen.width-30,30),line, style))
Select(i);
i++;
}
GUI.EndGroup();
}
}
Also tried adding a Box, but it creates its own background image. How can I implement this?