I want to stop my variable from increasing when my condition happens.
So far I have:
countText.enabled = false;
but this just hides the text on the screen. I just want it to stop increasing
I want to stop my variable from increasing when my condition happens.
So far I have:
countText.enabled = false;
but this just hides the text on the screen. I just want it to stop increasing
I assume you increase the variable in the Update function, then you just increase the variable when countText is true
example
if(countText.enable)
countVar += 1f * Time.deltaTime;
Just use a boolean, flag it when you want to increment.
[Header("SCORE FLAG")]
public bool _scoreFlag;
void Start()
{
_scoreFlag = true;
}
void Update()
{
if(_scoreFlag)
{
//Unknown score increment logic
}
}
So wrap your score logic in an if statement using a bool. Set the bool to false when you dom’t wanna increment your score.