I’m trying to use a while loop to increase the time to 15f set by one of my variables. Yet Unity keeps crashing, I’m probably just missing something small because I’m exhausted, but any help would be great! Thanks!
Here is the fragment of code including Variables.
**These are Variables**
public float powerUpTime = 15f;
public float powerUpDecreaseTime = 0f;
public float powerUpIncreaseAmount = 0.05f;
**This is the Loop:**
if (aHandle.hasScoreX2 == true || aHandle.hasScoreX3 == true || aHandle.hasScoreX5 == true)
{
while (powerUpDecreaseTime <= powerUpTime)
{
powerUpDecreaseTime = powerUpDecreaseTime + powerUpIncreaseAmount;
if (powerUpDecreaseTime >= powerUpTime)
{
if (aHandle.hasScoreX2 == true || aHandle.hasScoreX3 == true || aHandle.hasScoreX5 == true && powerUpDecreaseTime == 15f)
{
aHandle.hasScoreX2 = false;
aHandle.hasScoreX3 = false;
aHandle.hasScoreX5 = false;
}
powerUpDecreaseTime = 0f;
}
}
}