Timeline for Unity Coroutine freezes game even though no loop
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 1, 2022 at 18:56 | comment | added | Kevin |
A couple of side notes that won't fix your freeze: You are setting the faintSecs value but not using it, and it's not necessary to yield break; at the end of a coroutine, only if you want to exit the coroutine in the middle.
|
|
| Jun 1, 2022 at 6:17 | comment | added | Adam B | I suspect the issue lies in the changestate function. 90% of the time I have endless loops, it's because I have a property that returns itself somewhere. For example public float Health => Health; instead of public float Health => health; maybe take a look for that. | |
| May 31, 2022 at 14:07 | comment | added | DMGregory♦ |
As I said, you need to share every line of code. We should be able to paste the example unmodified, without making up the contents of the ChangeState() method or the declaration of the faintSecs variable or Monster class.
|
|
| May 31, 2022 at 14:03 | history | edited | UserUser | CC BY-SA 4.0 |
added 922 characters in body
|
| May 31, 2022 at 13:59 | comment | added | UserUser | @DMGregory Thank you for trying to help :) I will edit the question | |
| May 31, 2022 at 13:55 | comment | added | DMGregory♦ | I'm unable to reproduce the problem with the code you've shown here. Putting this code into a new Unity project does not cause a freeze. Please edit your question to include a Minimal Complete Verifiable Example: every line of code we'd need to put into a new, empty project to successfully reproduce the issue. | |
| May 31, 2022 at 13:47 | history | asked | UserUser | CC BY-SA 4.0 |