Mirror Integration

Mirror is a popular open-source networking library for Unity, particularly well-suited for MMO-style and open-world games. Universal Friend List supports Mirror through the custom server implementation.

Prerequisites

Mirror Requirements

  • Mirror package installed (from Unity Asset Store or GitHub)
  • Basic Mirror network setup complete
  • A server to host the game or use Mirror's transport

Configuration

Mirror does not have a native friends system, so the custom server implementation is required for full friend functionality:

  1. Set Backend Type to Mirror
  2. Set Use Native Implementation to false
  3. Configure server URLs (see Server Setup)
  4. The MirrorCustomFriendSystem will be used automatically

User ID for Mirror

Mirror doesn't have a built-in user ID system - you provide this through your authentication system. Set the UserId on the FriendManagerInitializer after authentication completes:

// After your auth system logs in
var userId = myAuthSystem.GetUserId();
friendInitializer.Initialize(userId);

Example: Simple Mirror Connection

See Scripts/Examples/NetworkConnections/SimpleMirrorConnection.cs:

using Mirror;
using UnityEngine;

public class SimpleMirrorConnection : MonoBehaviour
{
    public NetworkManager networkManager;

    public void StartClient(string ip, int port) {
        networkManager.networkAddress = ip;
        networkManager.StartClient();
    }

    public void StartHost() {
        networkManager.StartHost();
    }

    public void OnClientConnect(NetworkConnection conn) {
        Debug.Log("Connected to Mirror server");
        // Initialize friend system with your user ID
        // For Mirror, use your own auth system
    }
}

Using with Custom Server

Mirror works best with the Node.js WebSocket server for real-time friend updates. The same server handles both your game traffic (via Mirror) and friend data (via HTTP/WebSocket to the friend API).

Architecture: Mirror handles game networking. The ElderWorldStudio server provides a separate API for friend management only.