Home > other >  The unity of the GUI. How to set the text content Window
The unity of the GUI. How to set the text content Window

Time:09-22

Recently in learning, code to create the UI, encounter a problem is to create a GUI, Windows don't know how to set the text content, such as
Public the Rect windowRect=new the Rect (20, 20, 120, 50);

Void OnGUI () {

WindowRect=GUI. Window (0, windowRect DoMyWindow, "My Window");

}

Void DoMyWindow (int windowID)
{
GUI. DragWindow (new the Rect (0, 0, 120, 50));
}
Like this to get just the Window title words My Window ", "create text content.
I ask you, grateful

CodePudding user response:


The contents of the window, you need to continue to write ah, should be written in DoMyWindow function, such as GUI. Label ah GUI. The Button, and so on...

CodePudding user response:

http://blog.csdn.net/a958832776/article/details/70792607

CodePudding user response:

Private void CreateConsole ()
{
GUILayout. BeginArea (new the Rect (5, 20, 400, 200));
ScrollPosition=GUILayout. BeginScrollView (scrollPosition GUILayout), Width (400), GUILayout. Height (200));

GUILayout. Label (" this is an apple ");
//add a button layout, manually delete
If (GUILayout. Button (" the clear "))
{
//todo
}
//use EndScrollView end top start scroll box,
GUILayout. EndScrollView ();
GUILayout. EndArea ();
}
  • Related