Deprecate OnPlayerTriggerEnter and OnPlayerTriggerExit
BoatFloater
Many worlds are uploaded with an incorrect assumption of OnPlayerTriggerEnter() and OnPlayerTriggerExit(), even today. They assume that it only fires for the local player, and fail to check if the triggered player is actually local before proceeding.
For clarity, I recommend deprecating these events in favor of new events:
void OnLocalPlayerTriggerEnter();
void OnLocalPlayerTriggerExit();
void OnAnyPlayerTriggerEnter(VRCPlayerAPI player);
void OnAnyPlayerTriggerExit(VRCPlayerAPI player);
The current events would essentially be a deprecated alias to
OnAnyPlayerTriggerEnter
and OnAnyPlayerTriggerExit
. I hope that beginner developers can understand the deprecation notice and use the right event for themselves.I suspect the majority of times a player trigger is used, it is meant to apply to only the local player, which can be done by checking if
player.isLocal
before proceeding with the trigger execution, but many beginner developers do not know to do this. Here are some examples I have come across in community labs (I have seen multiple examples of each):* A teleport that one player steps in but it mistakenly teleports everybody
* A door that opens when a player gets near and closes when they walk away, but when multiple players go through, an earlier player causes it to close in the face of a later player
* A menu that fades out when you get farther away which causes the menu to keep disappearing for the local player as other players walk up to and away from it
Obviously an SDK code change is not required to fix situations such as this, but I think deprecating the current event and adding the local only trigger event will help beginners make this mistake less often, especially if the Udon graph had a way to display the deprecation notice.
Log In
hdorriker
These two methods are responsible for more broken worlds in VRChat than anything else.