unity-networking
Unity Networking - Multiplayer Game Development
Overview
Multiplayer networking for Unity using Netcode for GameObjects, Mirror, or Photon frameworks.
Foundation Required: unity-csharp-fundamentals (TryGetComponent, FindAnyObjectByType, null-safe coding)
Core Topics:
- Client-server architecture
- State synchronization
- Lag compensation
- RPC (Remote Procedure Calls)
- Network variables
- Matchmaking
Quick Start (Unity Netcode)
using Unity.Netcode;
public class Player : NetworkBehaviour
{
private NetworkVariable<int> mHealth = new NetworkVariable<int>(100);
public override void OnNetworkSpawn()
{
if (IsOwner)
{
// Only owner can control
HandleInput();
}
mHealth.OnValueChanged += OnHealthChanged;
}
[ServerRpc]
void TakeDamageServerRpc(int damage)
{
mHealth.Value -= damage;
}
[ClientRpc]
void ShowDamageEffectClientRpc()
{
// Visual feedback on all clients
}
}
Network Architecture
- Authoritative Server: Server validates all actions (competitive)
- Client Authority: Clients control own entities (cooperative)
- Relay Servers: NAT traversal for peer-to-peer
- Dedicated Servers: Professional hosting
Synchronization Patterns
- Transform Sync: Position, rotation interpolation
- Network Variables: Automatic state replication
- RPCs: Remote method calls
- Ownership: Who can modify what
Reference Documentation
Netcode for GameObjects Fundamentals
Core networking concepts:
- NetworkManager setup and configuration
- Client-server architecture patterns
- State synchronization and RPCs
Best Practices
- Server authority: Prevent cheating
- Client prediction: Smooth movement
- Interpolation: Handle lag gracefully
- Bandwidth optimization: Delta compression
- Test with network simulation: Latency, packet loss
More from creator-hian/claude-code-plugins
unity-vcontainer
VContainer dependency injection expert specializing in IoC container configuration, lifecycle management, and Unity-optimized DI patterns. Masters dependency resolution, scoped containers, and testable architecture design. Use PROACTIVELY for VContainer setup, service registration, or SOLID principle implementation.
12unity-ui
Build and optimize Unity UI with UI Toolkit and UGUI. Masters responsive layouts, event systems, and performance optimization. Use for UI implementation, Canvas optimization, or cross-platform UI challenges.
11csharp-code-style
C# code style and naming conventions based on POCU standards. Covers naming rules (mPascalCase for private, bBoolean prefix, EEnum prefix), code organization, C# 9.0 patterns. Use PROACTIVELY for C# code reviews, refactoring, or establishing project standards.
11csharp-xml-docs
C# XML documentation with on-demand Haiku→Expert Review→Final workflow. Flexible Korean/English language support. Use when documenting C# APIs, properties, methods, classes, and interfaces.
10unity-testrunner
Unity Test Framework CLI automation and test writing patterns. Masters batchmode execution, NUnit assertions, EditMode/PlayMode testing, and TDD workflows. Use PROACTIVELY for test automation, CI/CD pipelines, or test-driven development in Unity.
10unity-performance
Optimize Unity game performance through profiling, draw call reduction, and resource management. Masters batching, LOD, occlusion culling, and mobile optimization. Use for performance bottlenecks, frame rate issues, or optimization strategies.
9