RunEvent in UdonBehaviour.cs will clear the wrong program variables on a behaviour when receiving an event that takes arguments. This can be a problem when the arguments names are something common like "player"
RunEvent currently sets some parameters with slightly mangled names to use as the arguments for events that take arguments such as OnPlayerJoined(VRCPlayerApi player). The problem is that it has some code from before the name mangling was automatic which gets called after the event fires and clears the parameters, but uses the wrong name for them.
The code in question is
foreach ((string symbolName, object _) in programVariables)
{
SetProgramVariable(symbolName, null);
}
Which can just be removed from UdonBehaviour.cs as an easy fix. The problem is that this code uses the unmangled name for the parameter. So after something like OnPlayerLeft(VRCPlayerApi player) is called, instead of clearing the parameter variable
onPlayerLeftPlayer
, the variable named
player
is cleared which will confusingly break any Udon program that defines a variable named
player
.