Search Issue Tracker
Third Party Issue
Votes
0
Found in
2022.3.58f1
6000.0.38f1
6000.1.0b6
6000.2.0a3
Issue ID
UUM-97497
Regression
No
[sw-unity-6-1] Code is executed twice in a Coroutine when "WaitUntil(() => Input.GetKeyDown())" is used with "while(true)"
How to reproduce:
1. Open the "ReportingBugs.zip" project
2. Open the "WaitUntilScene" Scene
3. Enter Play Mode
4. Press the "F" key on your keyboard
5. Observe the Hierarchy
Expected result: One "Cube (Clone)" GameObject is instantiated
Actual result: Two "Cube (Clone)" GameObjects are instantiated
Reproducible in: 2022.3.58f1, 6000.0.38f1, 6000.1.0b6, 6000.2.0a3
Reproduced on: Windows 11 Pro (23H2)
Not reproduced on: No other environment tested
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Location tooltip in the Viewport of UI Builder window does not update when the UI Document Asset is moved to a different location
- Audio Clip Volume and Avoid Repeating Last fields values cannot be changed in Audio Random Container window
- Setting a variable in the root selector via an imported USS file in a theme does not work
- No character limit when creating a new Scene with excessively long name, Editor can be forced to crash
- URP Decal Projector flickers/glitches when added to Cube or Quad GameObjects as a Component
Resolution Note:
The user code is actually to blame here as the second WaitUntil call happens within the same frame as the one that got unblocked by the key press. Luckilly it seems WaitUntil today always wait for at least one frame so it does not end up with an infinite loop, but that is what I expected by looking at the code: within the same frame, Input.GetKeyDown(KeyCode.F) will always return true.