Quantcast
Channel: Latest Questions by GraviterX
Viewing all articles
Browse latest Browse all 122

Creating GUI inside an if statement

$
0
0
Hey guys. I'm having a problem with this Javascript. I want to have this line { (GUI.Box (Rect (10,10,100,90), stringToEdit); } that creates a GUI box inside of an if statement to create it when certain parameters are met. When I put it inside the if statement however, the GUI won't create. It will only create when I move it outside the if statement. Is there any way I can do this or something similar? var stringToEdit : String = "Hello World"; function OnGUI () { stringToEdit = GUI.TextField (Rect (100, 135, 200, 20), stringToEdit, 25); GUI.Box (Rect (10,10,100,90), stringToEdit); if (Event.current.type == EventType.KeyDown && Event.current.character == "\n"[0]) { stringToEdit = ""; //GUI.Box (Rect (10,10,100,90), "stringToEdit"); Debug.Log("GUIBox"); } }

Viewing all articles
Browse latest Browse all 122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>