Answer the question
In order to leave comments, you need to log in
Why is the if statement not working?
In my game, an enemy spawns every timespeed
second.
B is constantly decreasing and if
it should stop decreasing, but in the Inspector in Unity, you can see that it continues to decrease. Here is my code:Void Update() timespeed
timespeed == 0.5f
public float timespeed = 1.5f;
void Update()
{
if(timespeed != 0.5f)
{
timespeed = timespeed - 0.000002f;
}
else if(timespeed == 0.5f)
{
timespeed = timespeed;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question