Udon behaviours shouldn't run OnDisable in the editor when play mode is exiting
tracked
SenkyDragon
Many junk udon exceptions are logged in the editor because OnDisable events are called in UdonBehaviour when the editor scene is unloading while leaving play mode. The object destruction order isn't defined, which leads to many issues:
* The Networking.LocalPlayer may be null (something that cannot happen in game)
* Player data persistence may have already been destroyed
* Random sibling objects used by behaviours may have already been destroyed
* The UdonManager may have already been destroyed (which is really bad, because if it's used, for instance by calling SendCustomEventDelayedFrames, it constructs a new instance and unity complains that new objects appears during the teardown process. Also, when the new second instance of UdonManager is created, it recreates all the
PrimitiveType[] primitiveTypes
too)tl;dr: At least in the editor, UdonBehaviour.RunEvent shouldn't be executed if EditorApplication.isPlayingOrWillChangePlaymode is false.
Log In
SenkyDragon
It seems that this same issue can happen in game in some situations, so a portion of this bug report may be invalid (and devs just need to protect more against null objects and LocalPlayers).
However, the UdonManager being recreated when accessed while play mode is exiting is still an issue that should be fixed.
This post was marked as
tracked
SenkyDragon
This is harmony patched by vrcfury in 1.1302