question

Dawid Majdanik avatar image
Dawid Majdanik asked

Is there a way to notify other lobby users about connected or disconnected player?

Hello,

I am using PlayFab Lobby API and I can not find a way to notify lobby users about actions such as new connection or disconnection. I tried using events from PlayFabEvents.cs class but I can't find any that is responsible for lobby changes.

I tried using OnMultiplayerUpdateLobby Request/Response but I can get it working.

Is there any other way that I sould try or OnMultiplayerUpdateLobby is a way to go?

apis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

I believe you are using Multiplayer Unity Plugin. When a player joins or leaves a lobby, PlayFabMultiplayer.OnLobbyMemberAdded event or PlayFabMultiplayer.OnLobbyMemberRemoved event will be triggered. You can implement the notification feature based on it.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dawid Majdanik avatar image Dawid Majdanik commented ·

Thank you for your answer! My Multiplayer Plugin was not up to date and that was the reason why I couldn't find it.

Now I am facing other problem, after subscribing to those events they aren't invoked.

The way I subscribe to events:

PlayFabMultiplayer.OnLobbyMemberAdded += OnLobbyMemberAdded;

And method:
private void OnLobbyMemberAdded(Lobby lobby, PFEntityKey member)
{
	Debug.Log("OnLobbyMemberAdded");
}

I also tried using initialization:

PlayFabMultiplayer.Initialize();

but it doesn't change anything. After new player joins to lobby it's not invoked and I am not sure what is wrong. I know that new player has joined because to be 100% sure I use GetLobby method.

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Dawid Majdanik commented ·

In my test, those two events are triggered properly when a player joins or leaves the lobby. Please make sure you have followed Quickstart: PlayFab Multiplayer Unity plugin to set up your scene properly.

1 Like 1 ·
Dawid Majdanik avatar image Dawid Majdanik Gosen Gao commented ·

Hello and sorry for long answer time but I have forgot about this topic. In my case I was missing EventProcessor prefab on scene. Now everything works! Thank you for your answer :)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.