One of 2 clients gets duplicate OnEvent in PUN when using a self hosted server plugin

I have created a plugin self hosted server for our game and everything works fine except when 2 users are connected, user #1 will get duplicate events but user #2 does not. If I switch which computer connects first the problem also switches. I did some debugging and the plugin sends 1 copy of the message but the PUN unity component gets 3 separate events raised. Anyone know what could be causing this? Both machines are physically on the same network as the server so network latency should not be an issue.

Comments

  • ZigzaTomZigzaTom
    edited May 6
    Sorry its 5 duplicates not 3. Also the messages are sent via broadcast with a single actor number of the target person.
  • JohnTubeJohnTube mod
    edited May 6
    Hi @ZigzaTom,

    Thank you for choosing Photon!

    You are probably registering the OnEvent event multiple times maybe from different scripts.
    Make sure to subscribe += in OnEnable and unsubscribe -= in OnDisable.
  • Thanks. That was it!
Sign In or Register to comment.