Quantcast
Channel: Photon Server — Photon Engine
Viewing all articles
Browse latest Browse all 1557

Photon Server + Plugin + Unity bug?

$
0
0
Hi,

I'm wokring with photon plugin for self hosted server for quite a while now and everything is nice.

However, recently I came across a bug which I cannot explain from my code.

I have the following instantiation function run from the photon plugin:
public void Instantiate(List<int> targetPlayers)
{         
           // remove a player that joined earlier (to recreate the bug) right before sending the instantiate of the new player event to everyone
            if(targetPlayers.Count > 4) {               
                myPlugin.PluginHost.RemoveActor(targetPlayers[1], "test");
                for(int i=0;i<100000000;i++); // let photon start removal process
            }

            // send the instantiate event to the players interested (THIS calls pluginHost.BroadcastEvent()  )
            PunFunctions.Instantiate(this.myPlugin, viewIDs, targetPlayers, this.actorNr,
                  RoleKeys.prefabs[entityDynamicStats.playerRole], entityTransform.position, entityTransform.rotation, 0, playerInfo);

}

When I join the 5th player the following happens:

The "targetPlayers" are: 1, 2, 3, 4, 5 (ActorNrs)
I'm removing actorNr = 2 from the game, but not from the list to whom to send the instantiation event (targetPlayers)

=> all players after actorNr 2 in the list DO NOT GET EVENT.
so in this case, only player 1 gets the instantiation event of joining player 5.

This is a bug in my opinion, since, only player 2 is leaving, I expect all other players to get the event.
It seems pluginHost.BroadcastEvent() just stops sending the events once it runs into an issue sending to player 2 which is leaving.

I do not see any issues in the photon server logs, and no exceptions in VS when I run in debug mode.

Any help?

Viewing all articles
Browse latest Browse all 1557

Trending Articles