5min read

Unity Multiplayer—How to Develop Interactive Games in VR, AR, mobile

It’s fun to play alone but interacting with other players can be much more entertaining. Studies have shown that games can bring friends together and enhance socializing—roughly 70% of all users play with friends at least some of the time (source). As a backend developer, I had a chance to do a thorough research of how it can be done using Unity.

There are several application levels where we can introduce the multiplayer. First of all, we can add it by ‘direct’ interaction between players. We can visualize it with a typical shooting game (FPS) or by solving puzzles with a friend in VR. Secondly, we can make our app more sociable by adding a chat or leaderboards. Of course, it’s common to meet a combination of both.

Multiplayer Features in Unity

Unity has mechanisms that allow you to add a multiplayer feature to the game. For instance, you can use HLAPI (High Level API), which works in a way that one of the users becomes the server and others are joining as clients. Implementation is simple because we mainly operate on NetworkManager, which manages the whole networking process for us, so we can focus on building a high-level logic. As the guarantee of fair gaming and a single source of truth, it’s possible to write remote methods (RPC) which are called by clients but run on the server. We can create one of our methods by adding to the above declaration [Command] and starting its name with Cmd (for example void CmdGiveObject()). Also, NetworkServer gives us a method to Spawn (create) new objects, so the amount of created bullets, for example, will be controlled by the server.

Unity also gives a more advanced method for networking - Transport Layer API. Here in your own script you set up a networking system on the low level and use one of two protocols: UDP or WebSockets.

Multiplayer with Firebase SDK

As a backend developer, I couldn’t wait to check how Firebase works with Unity. Firebase is Google’s Backend-as-a-Service (on Google Cloud) which is often used by mobile developers to create basic components. Using Firebase SDK in Unity is significantly helping with introducing the multiplayer feature in an application. It’s easy to set up because we create the application in Firebase console and download credential files for mobile systems (google-services.json for Android and GoogleService-Info.plist for iOS). Then we download SDK, import it as assets and choose the functionalities we need. Firebase has set of tools, which helps us with the key components. For example, adding Authentication module goes really fast, which makes it easy to add OAuth with multiple options (Google, Facebook, Twitter, Github, phone) or simple Login-Password method. At Polidea we often Firebase for handling Push Notifications—it’s also possible in Unity apps.

I found the Realtime Database feature to be the most fascinating. It’s the noSQL database which synchronizes a state of the app between devices immediately.

Let’s imagine we’ve got an AR app in which we go shopping with our friends. With Realtime Database we can synchronize what we have in our common virtual basket so we won’t buy the same products. For the multiplayer conjunction games (such as board games, eg. chess or tic-tac-toe) sharing the moves is a great solution. It’s also a good place to keep the current player state after save to resume the game later.

The Challenges

Sometimes you can encounter some configuration problems. Most of them are well-known and it’s easy to find the solution on the internet (Myself, I had problems with unavailable Schemas with simulators in Xcode). Unfortunately, some feature issues are caused when certain platforms are not supported. For example, when I tested my authorization script it was returning errors in play mode. That was the moment when I learned that some Firebase plugins won’t work everywhere and I started testing it on an iOS simulator directly, which of course slowed down the whole development process. It’s currently impossible to run desktop Unity apps and it’s not clear if it’s going to be supported any time soon.

What else?

There are also other ways of handling the multiplayer feature. First of all, it’s possible to write your own server or example in NodeJS. It requires a thorough understanding of writing games, but in terms of language preferences and freedom of writing performance algorithms, it might be worth considering. Secondly, there are some tools available in the Unity Asset Store. DarkRift is known as the fastest networking library. Unfortunately, it works only with Unity 4, that’s why I can’t wait for DarkRift 2—which will work with Unity 5—to be released (on website creators mention that it’s in beta phase). The most popular networking framework is PUN (Photon Unity Networking) which also works with Unity 5. Additionally, there’s PUN+ that supports Unity 4. Both DarkRift and PUN are free for up to 20 users in one app.


As you can see, there are many options available for adding multiplayer features to your game or application, depending on your needs. Adding a social element to the app and bringing together its users is something worth considering—especially from the business point of view. If you’re looking into adding a multiplayer function to your app—get in touch, we have some experts at Polidea that can make it happen;)


KatarzynaSoftware Engineer


Sign in and expect sharp insights, recommendations, ebooks and fascinating project stories delivered to your inbox

The controller of the personal data that you are about to provide in the above form will be Polidea sp. z o.o. with its registered office in Warsaw at ul. Przeskok 2, 00-032 Warsaw, KRS number: 0000330954, tel.: 0048 795 536 436, email: (“Polidea”). We will process your personal data based on our legitimate interest and/or your consent. Providing your personal data is not obligatory, but necessary for Polidea to respond to you in relation to your question and/or request. If you gave us consent to call you on the telephone, you may revoke the consent at any time by contacting Polidea via telephone or email. You can find detailed information about the processing of your personal data in relation to the above contact form, including your rights relating to the processing, HERE.

Data controller:

The controller of your personal data is Polidea sp. z o.o. with its registered office in Warsaw at ul. Przeskok 2, 00-032 Warsaw, KRS number: 0000330954, tel.: [0048795536436], email: [] (“Polidea”)

Purpose and legal bases for processing:


Used abbreviations:

GDPR – Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016
on the protection of natural persons with regard to the processing of personal data and on the free movement
of such data, and repealing Directive 95/46/EC (General Data Protection Regulation)

ARES – Polish Act on Rendering Electronic Services dated 18 July 2002

TL – Polish Telecommunications Law dated 16 July 2004

1)        sending to the given email address a newsletter including information on Polidea’s new projects, products, services, organised events and/or general insights from the mobile app business world |art. 6.1 a) GDPR, art. 10.2 ARES and art. 172.1 TL (upon your consent)

Personal data:name, email address

2)       statistical, analytical and reporting purposes |art. 6. 1 f) GDPR (based on legitimate interests pursued by Polidea, consisting in analysing the way our services are used and adjusting them to our clients’ needs, as well as developing new services)

Personal data:name, email address

Withdrawal of consent:

You may withdraw your consent to process your personal data at any time.

Withdrawal of the consent is possible solely in the scope of processing performed based on the consent. Polidea is authorised to process your personal data after you withdraw your consent if it has another legal basis for the processing, for the purposes covered by that legal basis.

Categories of recipients:

Your personal data may be shared with:

1)       authorised employees and/or contractors of Polidea

2)       persons or entities providing particular services to Polidea (accounting, legal, IT, marketing and advertising services) – in the scope required for those persons or entities to provide those services to Polidea


Retention period:

1)       For the purpose of sending newsletter to the given email address – for as long as the relevant consent is not withdrawn

2)       For statistical, analytical and reporting purposes – for as long as the relevant consent is not withdrawn

Your rights:


Used abbreviation:

GDPR – Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016
on the protection of natural persons with regard to the processing of personal data and on the free movement
of such data, and repealing Directive 95/46/EC (General Data Protection Regulation)

According to GDPR, you have the following rights relating to the processing of your personal data, exercised by contacting Polidea via [e-mail, phone].

1)       to access to your personal data (art. 15 GDPR) by requesting sharing and/or sending a copy of all your personal data processed by Polidea

2)       to request rectification of inaccurate personal data
(art. 16 GDPR) by indicating the data requiring rectification

3)       to request erasure of your persona data (art. 17 GDPR); Polidea has the rights to refuse erasing the personal data in specific circumstances provided by law

4)       to request restriction of processing of your personal data (art. 18 GDPR) by indicating the data which should be restricted

5)       to move your personal data (art. 20 GDPR) by requesting preparation and transfer by Polidea of the personal data that you provided to Polidea to you or another controller in a structured, commonly used machine-readable format

6)       to object to processing your personal data conducted based on art. 6.1 e) or f) GDPR, on grounds relating to your particular situation (art. 21 GDPR)

7)       to lodge a complaint with a supervisory authority,
in particular in the EU member state of your habitual residence, place of work or place of the alleged infringement if you consider that the processing
of personal data relating to you infringes the GDPR
(art. 77.1 GDPR)

No obligation to provide data:

Providing your personal data is not obligatory, but necessary for Polidea to provide you the newsletter service

Refusal to provide the above data will result in inability to receive the newsletter service.


In the process of providing the newsletter service, we make decisions in an automated way, including profiling, based on the data you provide.


“Profiling” means automated processing of personal data consisting of the use of your personal data to evaluate certain personal aspects relating to you, in particular to analyze or predict aspects concerning your personal preferences and interests.


The automated decisions are taken based on the analysis of clicked and viewed content. They affect the targeting of specific newsletter content to selected users registered to receive the newsletter service, based on the anticipated interests of the recipient.