Start event should be fired before processing CustomEvent and SendCustomNetworkEvent
naqtn
CustomEvent
could be fired by other UdonBehaviour before Start
is fired. So, Udon programmer who implements this CustomEvent must check already initialized or not before CustomEvent body (and do initialize if needed). It's inconvenient and waste of time (in the meaning of both run-time and writing-time of users).I prefer to do Start before CustomEvent if it's not done yet. All of the above is same for SendCustomNetworkEvent case.
(This might be a "feature request" but I chose "bug report" section because I guess this is not intended implementation.)
SDK Version: VRCSDK3-UDON-2020.05.12.10.33
--- Details
In UdonBehaviour.cs, Udon
Start
event is fired in C# Update
methods.Events other than SendCustomEvent and SendCustomNetworkEvent have
if(!_hasDoneStart)
check at the beginning. So it is guaranteed that Start is fired before these events in Udon program. On the other hand, SendCustomEvent does RunProgram without _hasDoneStart
guard.My request is inserting same thing, that C# Update method does, into SendCustomEvent.
if(!_hasDoneStart)... RunProgram(startPoint) ...
Log In
Merlin
This might make sense for network events since something may not have been initialized yet and it might not be in a valid state for networking. But I don't think that it should be a thing for normal CustomEvents, maybe there should be a second version of SendCustomEvent with this functionality if you want it. Because otherwise it makes it impossible to have parity with C# if SendCustomEvent is locked behind an object having already executed Start(). In C# with Unity it's totally valid to call methods on disabled objects that have not had Start called on them. There's actually a bug report for this not being the case in Udon https://vrchat.canny.io/vrchat-udon-closed-alpha-bugs/p/sendcustomevent-fails-on-gameobjects-that-where-instantiated-in-the-same-functio This seems like it's the intended implementation for SendCustomEvent at least, I do not know about SendCustomNetworkEvent.