Question by
ACereal · Jan 30, 2019 at 11:08 PM ·
c#scripting problem
Problem with my script
I'm trying to get a maximum and minimum selector, so when you click (for example) the max button, the maximum displayed with text would be raised by the amount listed in the script, but whenever I click the button that activates a certain part of the script, it only works the first time... the second time nothing happens. Please help! I'm very new to Unity and C#
My Script: {
[SerializeField] TextMeshProUGUI minText;
[SerializeField] TextMeshProUGUI maxText;
int startingMinText;
int startingMaxText;
int minimumText;
int maximumText;
void Start()
{
startingMinText = 0;
startingMaxText = 1000;
StartGame();
}
void StartGame()
{
minText.text = startingMinText.ToString();
maxText.text = startingMaxText.ToString();
}
public void MinWhenPressed()
{
minimumText = (startingMinText + 100);
NextMinPress();
}
public void MaxWhenPressed()
{
maximumText = (startingMaxText + 125);
}
void NextMinPress()
{
minText.text = minimumText.ToString();
}
void NextMaxPressed()
{
maxText.text = maximumText.ToString();
StartGame();
}
}
Comment