- Home /
Question by
vincentamato · Jan 19, 2015 at 09:08 PM ·
bugcrashgameproblem during runtime
Unity Crashes Every time I Try To Run This Code
Hi. My problem is simple. Whenever I try to run this:
void Update(){
while (invokeCanceled == false) {
if (canvasGroup.alpha >= 1f) {
CancelInvoke ("FadeIn");
invokeCanceled = true;
}
}
}
Unity crashes. I don't know why. Any ideas?
Comment
Just do an if statement ins$$anonymous$$d:
void Update(){
if (!invokeCanceled) {
if (canvasGroup.alpha >= 1f) {
CancelInvoke ("FadeIn");
invokeCanceled = true;
}
}
}
Answer by smoggach · Jan 19, 2015 at 09:43 PM
Update is the main loop of the program. If you stop the entire program to wait for a value that can no longer change (because you've stopped the program) your program will crash.
Your answer
Follow this Question
Related Questions
Unity 5 Lights Transport Jobs 9 Answers
Crash the entire game 3 Answers
Unity instantly crashes when switching from game to scene view. 2 Answers
Stuck on splash screen android 0 Answers