- Home /
Question by
matijas_05 · Sep 10, 2017 at 02:22 PM ·
guigui.labelongui error
Some code works in OnGUI(), some doesn't.
I was trying to make a dev console for my game using simple GUI system.
void OnGUI()
{
if (devConsoleToggle)
{
devInput = GUI.TextField(new Rect(0, 0, 150, 30), devInput); //this part works...
pauseMenu.SeemsPausedOn();
if (Input.GetKeyDown(KeyCode.Return))
{
if (devInput.Split(' ')[0] == "info")
{
string commDescToGet = devInput.Split(' ')[1];
Command commDescToShow = Array.Find(commands, command => command.name == commDescToGet);
GUI.Label(new Rect(100f, 100f, 20f, 400f), commDescToShow.description); //...but this doesn't
devConsoleToggle = false;
}
}
}
else pauseMenu.SeemsPausedOff();
}
GUI.TextField works perfectly fine, but GUI.Label doesn't. I was forced to do it by Unity 4.6's new UI. Can someone tell me why this isn't working?
Comment
Answer by N00MKRAD · Sep 11, 2017 at 07:19 AM
It's 2017, OnGUI has been dropped years ago.
Why are you still using it?
Your answer
Follow this Question
Related Questions
How to use line break for GUI.Lable 1 Answer
Gui now showing up! Nothing to do D': 0 Answers
Centering a GUI label with varying text length 1 Answer
Multiple GUI.Labels to appear and disappear 1 Answer
Fonts in Android... 0 Answers