Hello, I can’t seem to understand how you would be able to edit for example a GUI text with a button. For example if I want to make a textbox and have a button make the text += 1 every time I click it how would I go about doing this? I have read some basic tutorials on GUI’s, however I don’t understand how you get the name to change the text of for example that textbox in c#.
Hi, you could store the value you want to display in a variable, GUI is rendered every frame so it will immediatly display the value of you variable after it has been modified a way or another.
Example:
//This is an integer variable that you can increment
int theValue = 0;
void OnGUI()
{
//Will display what is inside the variable 'theValue'
GUILayout.Label(theValue.ToString());
//Button will return true when clicked, and it will add +1 to 'theValue'
if (GUILayout.Button("Increase theValue"))
theValue += 1;
}
Good luck with learning programming, maybe you should try with simple C# tutorials to get used to it.