Photon.Realtime.Player.GetHashCode() is busted

The implementation uses the actor number as the hashcode, but the actor number is changed during the Player object's existence (when a Player disconnects, it is changed to -1).

This is a big no-no in C#, and results in hard-to-diagnose bugs when using Player as a key in a hashtable.


  • Good point.

    Actually, the Player has no meaning when leaving a room. It probably should not exist at all, while disconnected but that complicates matters (lots of additional null checks).

    GetHashCode could possibly be changed to always return -1 for the local player.