Update is executed for one frame after the script is disabled
tracked
みみー/Mimy
Update is executed for one frame after the script is disabled.
Reproduction Procedure:
Prepare a U# script that outputs OnEnable(), OnDisable() and each Update() log (see image).
Attach this script to the game object and play it in ClientSim.
When this script (component) is enabled, it will be disabled after 3 frames and output the log of each event.
The log in chronological order shows that each Update() is executed after OnDisable().
(see this video : https://twitter.com/mimyquality/status/1749001703893164421 )
This also happens when switching "enabled" from other U# scripts, etc. or when switching the active game object.
It seems to have started occurring since Unity Editor was changed to Unity 2022.3.6f1.
Translated with www.DeepL.com/Translator (free version)
Log In
|KitKat|
This issue is really annoying. I hope it gets fixed soon.
Fax
tracked
Fax
needs more information
Hi みみー/Mimy! Thank you for reporting this bug.
I think you are correct: After "OnDisable" is executed, the UdonBehaviour executes other events for one additional frame. This contradicts the event execution order in our documentation. https://creators.vrchat.com/worlds/udon/event-execution-order
However, it seems like this issue is not related to Unity 2022. I was able to reproduce the issue in Unity 2019 as well. Would you mind verifying if that's the case for you as well?
みみー/Mimy
Fax: I have confirmed that I can reproduce this in Unity 2019. It certainly does not seem to depend on the Unity version.
(Confirmed with VRCSDK 3.4.2)