- Home /
Question by
hi_rahul86 · Jan 05, 2012 at 03:28 PM ·
buttonuser interfacetextbox
Creating User Interface
Hi,
Can anyone tell me how to create simple user interface containing only a button and textbox
Comment
Take a look at the `GUILayout` class, it has everything you need.
http://unity3d.com/support/documentation/ScriptReference/GUILayout.html
Best Answer
Answer by dorpeleg · Jan 05, 2012 at 07:16 PM
void OnGUI() {
GUI.TextField(new Rect(Screen.width/2-150, 500, 600, 600),"text");
if(GUI.Button(new Rect(Screen.width/2-50, 200, 200, 30), "button text")){
//do somthing
}
this should help you
Your answer
![](https://koobas.hobune.stream/wayback/20220613062711im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Hidden Canvas, doesn't disable interaction with buttons. 1 Answer
Augmented reality - UI - How do I augment an User Interface Canvas properly? 0 Answers
Create a button to instantiate and drag GameObject 1 Answer
Unity5 UI - How to trigger button click event while preventing menu item deselect event? 1 Answer
Prefab Canvas's buttons arn't working in different scene 4 Answers