What exactly means such console message:
"GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly."
The code what causes it to appear is:
public class MenuCode : MonoBehaviour
{
enum menuStates
{
mainMenu=0,
difficultyChoose,
options,
geoscape
}
menuStates currentMenuState;
public GUISkin geoscapeSkin;
void Awake()
{
currentMenuState=menuStates.mainMenu;
Screen.showCursor=true;
}
void OnGUI()
{
switch(currentMenuState)
{
case menuStates.mainMenu:
createMainMenu();
break;
case menuStates.geoscape:
break;
}
}
void createMainMenu()
{
GUI.skin=geoscapeSkin;
if(GUI.Button(new Rect(Screen.width/2,Screen.height/2,285,62),"NEW CAMPAIGN")) button1Click();
GUI.Button(new Rect(Screen.width/2,Screen.height/2+67,285,62),"CONTINUE GAME");
}
}
↧