Managing Players
An important aspect of any local multiplayer game is handling players joining and leaving. The Local Multiplayer module provides multiple methods to manage players during gameplay.
Adding Players
You can add Local Players through two main methods:
Visual Scripting
Use the Add Local Player instruction to:
- Spawn a new player with custom settings
- Override the default player prefab
- Control exact spawn timing and location
Local Player Manager
Configure the Local Player Manager component's Join Behavior to:
- Join when any button is pressed
- Join when a specific input action is triggered
- Join manually through instructions
Join Configuration
Review the Component documentation to learn more about configuring join behaviors and restrictions.
Removing Players
Player removal is handled through visual scripting:
Visual Scripting
Use the Remove Local Player instruction to:
- Remove a specific player
- Clean up associated resources
- Handle player disconnection logic
Resource Cleanup
Always use the Remove Local Player instruction to properly clean up player resources. Don't destroy player objects directly.