Player Invite System Standalone

The Player Invite System is a lightweight, robust solution for managing game room invitations. Designed as a replacement for the full Lobby System, it provides essential connectivity for projects where the Lobby System is not installed.

Note: This addon is not needed if you have the full Lobby System installed, as the Lobby System includes a more robust and integrated version of these features. Use this only for standalone or custom implementations.

Key Features

Smart Logic

Automatically handles different scenarios:

  • Sender Not In Room: Creates a room automatically, then sends the invite.
  • Sender In Room: Sends invite to current room.
  • Target In Room: Sends a "Join Request" instead of an invite.

Seamless Invitations

Send invites to friends or other players instantly via Photon Networking. Handles data transmission securely.

Smart Popups

Non-intrusive UI popups appear when an invite or join request is received, displaying the sender's name and intent.

One-Click Join

Accepting an invite automatically handles the room switching process, leaving the current game and joining the new one seamlessly.

Integration & Setup

Getting the invite system running is straightforward:

1. Scene Setup

Add the Player Invite Manager prefab to your singleton canvas or main manager object. Ensure it persists across scenes.

2. Triggering an Invite

Call the invite method from your friend list UI:

// Send invite to a specific Photon Player
bl_PlayerInvite.Instance.SendInvite(targetPlayer);

3. Message Protocol

The system uses a custom split pattern to pack room details into a lightweight string:

Format: SenderName @##@ RoomName @##@ CurrentPlayers @##@ MaxPlayers @##@ AvatarID

4. Advance Chat Integration

If you are using the Advance Chat addon, you need to manually add the following code to bl_Advance_LobbyChat.cs to enable invite interception.

Location: Assets/Addons/BlinkBox/AdvanceChat/Scripts/bl_Advance_LobbyChat.cs

Method: OnPrivateMessage (around line 1905)

#if PIS
// PIS Integration: Intercept Invite and Join Requests
if (messageData.text.StartsWith("//INVITE//"))
{
if(LogMessageEvents) LogDebug($"Forwarding invite message to PlayerInvite system from {sender}");
string cleanData = messageData.text.Replace("//INVITE//", "");
bl_PlayerInvite.Instance?.HandleInviteMessage(sender, cleanData);
return;
}
else if (messageData.text.StartsWith("//JOIN//"))
{
if(LogMessageEvents) LogDebug($"Forwarding join request to PlayerInvite system from {sender}");
bl_PlayerInvite.Instance?.HandleJoinRequest(sender);
return;
}
else if (messageData.text.Contains("accepted your invitation") || messageData.text.Contains("declined your invitation"))
{
if(LogMessageEvents) LogDebug($"Forwarding invite response to PlayerInvite system from {sender}");
bl_PlayerInvite.Instance?.HandleInviteResponse(sender, messageData.text);
return;
}
#endif

Configuration Options

Customize the behavior via the Inspector on `bl_PlayerInvite`:

  • Popup Duration: How long the invite stays on screen (default: 10s).
  • Max Popups: Limit the number of stacked invites to prevent UI clutter.
  • Sound Effects: Assign custom clips for "Invite Received" and "Invite Accepted".
  • Animation: Customize the entry/exit animations of the popup notification.