When I called VRCPlayerApi.playerId of the parameter of OnPlayerLeft(), it returns -1 even IsValid() returns True.
Official document describes it should be return player id.
It never happenes if that player's id has read before they leaving from the world.
I guess it will happenes only when the id hasn't "cached".
Note here, the exact date is unknown, but it used to work. I think it was broken by a recent update.
Probably when it went to 2019.
Here is the reproducible code:
public class OnPlayerLeftTest : UdonSharpBehaviour
{
public override void OnPlayerLeft(VRCPlayerApi player)
{
Debug.Log($"OnPlayerLeft() player valid:{player.IsValid()} , id:{player.playerId}");
}
}
Join the world with 2 or more player, and see log after one of them has left.
You can find the log like:
OnPlayerLeft() player valid:True,id:-1