Class UnityPlayerInputJoinService
Service that coordinates the PlayerInputManager, applies filtering/gating rules, and assigns slots when players join.
Manages the complete player join/leave lifecycle with device filtering, slot assignment, and event notification.
Initializes explicitly via Initialize method to avoid Awake ordering issues with dependencies.
Namespace: Serenity.InputGateway.Infrastructure.Services
Assembly: Serenity.UnityPlayerInput.Infrastructure.dll
Syntax
public class UnityPlayerInputJoinService : MonoBehaviour, IPlayerInputJoinService, IService, IFoundationSettings
Constructors
UnityPlayerInputJoinService()
Declaration
public UnityPlayerInputJoinService()
Properties
Guid
Declaration
public string Guid { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
| Type | Description |
|---|---|
| ILogService |
Methods
DisableJoining()
Disables player joining to prevent new players from connecting.
Safe to call even if the service is not initialized or manager is null.
Declaration
public void DisableJoining()
EnableJoining()
Enables player joining based on the configured join behavior settings.
Only enables joining if the service is initialized and join behavior is set to JoinOnPress.
Declaration
public void EnableJoining()
Initialize(PlayerInputManager, UnityPlayerInputRoutingSettings, UnityPlayerInputSlots)
Initializes the service with required dependencies and subscribes to player join/leave events.
Must be called from the factory after setting up all component references.
Validates all dependencies and logs warnings for missing components.
Declaration
public void Initialize(PlayerInputManager manager, UnityPlayerInputRoutingSettings settings, UnityPlayerInputSlots slots)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerInputManager | manager | The PlayerInputManager component for handling player connections. |
| UnityPlayerInputRoutingSettings | settings | Routing settings containing filter and gate rules. |
| UnityPlayerInputSlots | slots | Slots provider for managing player slot assignments. |
Events
OnJoined
Declaration
public event Action<string> OnJoined
Event Type
| Type | Description |
|---|---|
| Action<string> | Event triggered when a player successfully joins and passes all filtering/gating rules. |
OnLeft
Declaration
public event Action<string> OnLeft
Event Type
| Type | Description |
|---|---|
| Action<string> | Event triggered when a player leaves the game session. |