Not a Bug

Unity Editor Freeze

love pug 2 years ago updated 2 years ago 3

I made a sample that displays a message after a certain period of time.

There is no problem using update.
However, if I used while, UnityEditor freezes when I press Play, it will not accept the operation.
I will erase the Unity process with the task manager.

<update is okay>

<while freeze>
I tried putting debug log in the body of while, but nothing is displayed.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Bolt 2
Satisfaction mark by love pug 2 years ago

Yes, this is correct behavior. If you did the same thing in a C# script you would freeze Unity as well. While runs it's conditional in a single frame. You are trying to loop over a variable that will not be true for many many frames, and firing this over and over which eventually freezes the application.

Not a Bug

Indeed. Use a Wait Until unit instead of While and your problem will be fixed!

thank you! Jason & Lazlo

I think that I need more study.