Mirror Unity Multiplayer Integration for Mobile Game

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Mirror Unity Multiplayer Integration for Mobile Game
Complex
~1-2 weeks
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Mirror Multiplayer Integration for Mobile Games (Unity)

Mirror—open-source network framework for Unity, successor to deprecated UNET. Unlike Photon, Mirror isn't cloud-locked: transport plugged separately (kcp2k, Telepathy, WebSockets, Steam), server self-hosted. For mobile projects, this means full control over latency, traffic, and hosting costs—but also full responsibility for infrastructure.

NetworkManager and Lifecycle

NetworkManager—entry point. Override only what's needed:

public class GameNetworkManager : NetworkManager
{
    public override void OnServerAddPlayer(NetworkConnectionToClient conn)
    {
        var startPos = GetStartPosition();
        var player = Instantiate(playerPrefab, startPos.position, startPos.rotation);
        NetworkServer.AddPlayerForConnection(conn, player);
    }

    public override void OnClientDisconnect()
    {
        base.OnClientDisconnect();
        // Reconnect logic for mobile
        StartCoroutine(TryReconnect());
    }
}

NetworkManager.singleton—static access to instance. Critical mistake: creating multiple NetworkManager in scene. Mirror warns but doesn't crash—unpredictable behavior later.

SyncVar, SyncList, and Commands

[SyncVar] syncs variable from server to all clients automatically on change:

public class PlayerHealth : NetworkBehaviour
{
    [SyncVar(hook = nameof(OnHealthChanged))]
    public int health = 100;

    void OnHealthChanged(int oldVal, int newVal)
    {
        healthBar.fillAmount = newVal / 100f;
    }

    [Command]
    public void CmdTakeDamage(int amount)
    {
        // Executes only on server
        health = Mathf.Max(0, health - amount);
    }
}

[Command]—client calls method on server. [ClientRpc]—server calls on all clients. [TargetRpc]—on specific client. This triple is essential before everything else.

SyncList<T> syncs collections: inventory, buff queue, kill list. OnChange callbacks fire on any list change.

Transport Choice for Mobile

Transport Protocol Mobile
kcp2k UDP-based Recommended, low latency
Telepathy TCP Reliable, higher latency
WebSockets (Mirror) TCP/WS Needed for WebGL, not optimal native
Ignorance UDP (ENet) Good kcp2k alternative

For mobile native—kcp2k or Ignorance. kcp2k built-in since Mirror 50+. Settings: NoDelay = true, Interval = 10ms, FastResend = 2.

Headless Server and Infrastructure

Mirror server—same Unity build with -batchmode -nographics. For persistent match games, need dedicated server: one Unity instance per room (action games) or several (strategy with few players).

Orchestration: Game Server Hosting (Multiplay) from Unity Gaming Services or self-hosted on Kubernetes with autoscaling. For small projects—VPS on DigitalOcean/Hetzner with systemd management.

Mirror + Telepathy on TCP behind regular load balancer. Mirror + kcp2k (UDP)—needs UDP passthrough, not all load balancers support.

Typical Integration Problems

NetworkIdentity not found. Prefab not registered in NetworkManager.spawnPrefabs. Spawn via NetworkServer.Spawn crashes at runtime.

Authority confusion. isServer, isClient, isLocalPlayer, hasAuthority—four different bools. Code in Update() without isLocalPlayer check runs on all clients, including others' players.

Disconnect on mobile. iOS closes socket ~10 sec in background. Mirror doesn't auto-recover. Implement OnApplicationPause → on pauseStatus = false (return from background) → check NetworkClient.isConnected → reconnect.

Timeline

Basic Mirror integration with position sync, health, basic Command/RPC: 1-2 weeks. Full system with headless server, matchmaking, reconnect, and mobile optimization: 1-2 months. Cost calculated individually.