I'm a newbie in KSP mod creation, trying to make a GUI for my mod. I caught an issue with displaying text on GUI elements. For example I created a window with button and window had no title, button had no text on it. Button is work and I see debug message after click.
I tried to use GUI
instead of GUILayout
but had the same issue. I tried to use HighLogic.Skin.window
for window in GUILayout.Window(0, this.windowRect, this.DrawWindow, "Title", HighLogic.Skin.window)
and I saw the title of a window, but if I use HighLogic.Skin.button
in GUILayout.Button("Press me", HighLogic.Skin.button)
I have this issue again. So, I don't know how to fix it.
Code:
using UnityEngine;
namespace KCSS
{
[KSPAddon(KSPAddon.Startup.MainMenu, false)]
public class KCSS : MonoBehaviour
{
private Rect windowRect;
private void DrawWindow(int id)
{
if(GUILayout.Button("Press me"))
{
Debug.Log("[KCSS mod] <color=#f1a12e>Action:</color> Button pressed");
}
GUI.DragWindow();
}
public void Awake()
{
Debug.Log("[KCSS mod] <color=#66cccc>Load:</color> KCSS main class");
this.windowRect = new Rect(50, 50, 150, 100);
}
public void OnGUI()
{
this.windowRect = GUILayout.Window(0, this.windowRect, this.DrawWindow, "Title");
}
}
}
Screenshot of an issue: No text on title and button
Screenshot if I use HighLogic.Skin
: No button text only