NNabeel Hassan

Blog · December 5, 2026 · 8 min read

Adding Multiplayer to a Unity App: Photon, Netcode for GameObjects, or Just a Backend

By Nabeel Hassan — AI Engineer · ICPC World Finalist

TL;DR: Before picking a Unity networking library, work out which kind of "multiplayer" you actually need. Shared scores, challenges, turn-based play and "see what your friends did" do not need real-time netcode at all: a normal backend with a database, push updates and server-side validation is simpler, cheaper and easier to trust. Real-time netcode is for the case where several people share one live scene and see each other move within a fraction of a second. For that, a hosted service like Photon is usually the fastest path for a small team, Unity's Netcode for GameObjects with Relay and Lobby fits when you want to stay inside Unity's own stack, and dedicated servers are for when cheating or fairness really matter. PlayFab-style backends handle accounts, leaderboards and economy, not the live sync itself.

"Can we make it multiplayer?" is one of the most common questions I get on Unity projects, and it hides a much bigger decision than it sounds. I have spent more than five years in Unity, and Photon and PlayFab are part of my Unity toolbox. I have also led products where the "multiplayer" part turned out to be a backend problem, not a netcode problem. At RAQTS, the thing tying players together across the Unity Lumo layer, the mobile apps and the web portal is live leaderboards, and none of that needed a networking library inside Unity. This is how I decide.

First, what kind of multiplayer is it?

I sort every multiplayer request into one of four buckets before anything else:

  1. Asynchronous and shared state. Leaderboards, weekly challenges, ghost runs, gifts, "your friend beat your score". Players never need to be online at the same time.
  2. Turn-based. Chess-style games, quizzes where everyone answers then sees results, collaborative planning tools. Latency of a second or two is fine.
  3. Real-time, small and cooperative. Two to a handful of people in the same scene: co-op play, a shared AR or VR space, a trainer and trainee in a simulation. Players see each other move, but nobody gains much by cheating.
  4. Real-time and competitive. Shooters, racing, anything with ranked matches and prizes. Every millisecond and every exploit matters.

The first two buckets cover most of what non-game and casual products need, and they are the cheapest to build. Each step up from there adds a real jump in cost and complexity.

Buckets 1 and 2: you probably need a backend, not netcode

If players do not need to see each other move in real time, I build it like any other app feature:

This approach works across Unity, React Native and the web with the same API, which is exactly why it suited RAQTS: one source of truth that every client reads. It also inherits what you already do for a normal product, like error monitoring.

A useful test: if you could describe the feature as "a shared list that updates", it is a backend feature. Reach for netcode only when it is "a shared scene that moves".

Buckets 3 and 4: real-time netcode

Once people share a live scene, you need a networking layer that keeps object positions, animations and events in sync many times a second. Three questions shape the choice.

Who is the authority?

For bucket 3, I usually pick shared authority or a player host. For bucket 4, a dedicated server, or I push back on the scope.

How do players find and reach each other?

Phones and home routers sit behind NAT, so two devices usually cannot connect to each other directly. You need a relay service in the middle, plus some kind of lobby or matchmaking so players can find a room. Hosted services bundle both. If you build on lower-level libraries, you add them yourself.

What do you pay for?

Hosted networking is typically priced by concurrent users and bandwidth. Dedicated servers add compute per running match. For a small product, the bill is rarely the problem at launch. The problem is not knowing which number drives it, the same lesson as the unit economics of an AI app: find the expensive unit before you scale.

The options I actually consider

Photon

Photon is a hosted networking service with Unity SDKs, and it is the fastest way I know for a small team to get people into a shared room. It handles the relay, rooms and matchmaking, and has regional servers. PUN 2 is the older, very widely used SDK. Fusion is the newer one, with modes for shared authority and for host or server authority with client-side prediction. For a new project I look at Fusion first and check what the current SDK recommends, because Photon's lineup has changed over the years.

The trade-off is lock-in. Your networking code is written against Photon's model, and moving off it later is close to a rewrite of that layer.

Netcode for GameObjects with Relay and Lobby

Unity's own networking library, Netcode for GameObjects, works with Unity's Relay service for NAT traversal and Lobby for finding sessions. It fits well when the team wants to stay inside Unity's ecosystem and is comfortable with a host-and-client model. It can also run on a dedicated server build when you need server authority.

Open-source libraries

Mirror and FishNet are mature open-source networking libraries with active communities. They give you full control and no per-user licence, but you supply the hosting, relay and matchmaking yourself or pair them with a provider. I reach for them when the team has networking experience and a reason to avoid vendor lock-in.

PlayFab and other game backends

PlayFab is not a netcode library. It is a game backend: player accounts, leaderboards, inventories and virtual currency, server-side scripts and analytics. It pairs with any of the options above. For buckets 1 and 2, a backend like this, or your own, may be the entire multiplayer solution.

What bites teams on their first multiplayer build

These are the problems I plan for up front, because they show up on almost every first attempt.

Syncing too much

Syncing every transform every frame blows up bandwidth and the bill. I sync the minimum: positions at a sensible tick rate with interpolation on the receiving side, discrete events as one-off messages, and anything derivable computed locally. Animations are driven by synced state, not synced frame by frame.

Late joiners and reconnects

A player who joins mid-session needs the current state, not the history of events. Mobile players drop constantly: a phone call, a tunnel, the app going to the background, where the OS may suspend the socket. Every synced object needs a "here is the current state" path, and the game needs a reconnect flow that puts the player back in their seat without breaking anyone else's session.

Ownership and race conditions

Two players grab the same object at the same moment. Who wins? Decide the rule (first request the authority receives, or the current owner must release it) and make the authority enforce it. Leaving it to whichever packet arrives first produces bugs that only appear with real latency.

Testing with one machine

Multiplayer bugs need at least two clients. Unity's Multiplayer Play Mode and community tools like ParrelSync let you run several editor instances on one machine, and I add artificial latency and packet loss early, because everything works perfectly on localhost. Then I test on real phones on mobile data, the same reasoning as field testing AR apps: the lab hides the problems.

Version mismatches

A player on last week's build joins a room with this week's build, and the messages no longer match. Rooms should be partitioned by a protocol version, and the app should ask old clients to update. It is the real-time version of keeping old app versions working.

XR adds its own load

In shared VR or AR, each user is a head and two hands, updating constantly, and motion that is out of sync is uncomfortable, not just ugly. On standalone headsets the networking also competes for a frame budget that is already tight. Smooth interpolation and a low but steady update rate matter more than raw frequency.

My default picks

A quick checklist before you build

  1. Name the bucket. Async, turn-based, real-time co-op or real-time competitive.
  2. Pick the authority model and write down what a cheating client could do.
  3. Estimate concurrent users and bandwidth and price them on the provider you choose.
  4. List what gets synced, at what rate, and what is computed locally.
  5. Design late join and reconnect before the first playtest.
  6. Test with two or more clients, added latency, and real phones on mobile data.
  7. Version the protocol so old builds cannot join new rooms.

Multiplayer is a feature that quietly turns a single app into a distributed system. The teams that ship it well are the ones that pick the smallest kind of multiplayer that delivers the experience, then build that properly. If you are deciding who should build it, I wrote about how to hire a Unity developer, and the same questions apply with "have you shipped netcode?" added to the list.


I build Unity apps, XR platforms and the backends behind them, and lead engineering as a fractional CTO for teams with hard technical edges. If you are weighing how to add multiplayer to a Unity project, more about my background here, or book a call.

FAQ

Do I need Photon or Netcode for a Unity leaderboard or turn-based game?

Usually not. Leaderboards, challenges and turn-based play only need a backend that validates and stores results and pushes updates to clients. Real-time netcode is for players sharing one live scene and seeing each other move within a fraction of a second.

Should I use Photon or Netcode for GameObjects?

Photon is a hosted service with relay, rooms and matchmaking built in, so it is often the fastest path for a small team, at the cost of lock-in to its model. Netcode for GameObjects with Unity Relay and Lobby suits teams that want to stay in Unity's own stack, and it can also run on a dedicated server build when you need server authority.

Is PlayFab a multiplayer networking library?

No. PlayFab is a game backend for player accounts, leaderboards, inventories, virtual currency, server-side scripts and analytics. It pairs with a networking layer such as Photon or Netcode for GameObjects, and for asynchronous or turn-based features it can be the whole solution.

How do you stop cheating in a Unity multiplayer game?

Only a server-authoritative design, where a dedicated server owns the game state and clients send inputs, seriously limits cheating. Player-hosted and shared-authority setups trust clients for what they own, which is fine for co-op and shared XR spaces but not for ranked matches with prizes.

Building something in this space?

I take on AI-agent, automation and product work directly — scoped fast, shipped fast.

Book a discovery call →

Keep reading