Get Started

Photon Unity Networking (PUN) is a Unity package for multiplayer games. Flexible matchmaking gets your players into rooms where objects can be synced over the network. RPCs, Custom Properties or "low level" Photon events are just some of the features. The fast and (optionally) reliable communication is done through dedicated Photon server(s), so clients don't need to connect one to one.

PUN exports to basically all platforms supported by Unity and comes in two flavors:


PUN FREE No-cost package with various demos, pre-made scripts and reference documentation. Exports to basically all platforms.



PUN FREE Unity Plugin Same content as PUN FREE, plus a 100 concurrent user plan (about 40k monthly active) for the Photon Cloud (valid 60 months).

Get PUN PLUS for just $ 95.

Some Code Required

To get the best out of PUN, you will need to do some programming. This page shows you several important code snipptet but it's more of an overview than a guide.

To get properly started, work through the "PUN Basics Tutorial".

Connect and Callbacks

ConnectUsingSettings sets your client’s game version and uses the PhotonServerSettings for everything else. When you run this, PUN uses callbacks to let you know when the client established the connection, joined a room, etc.. Just like Unity's "magic methods", you only need to look up the callback method names and implement them. For example: OnConnectedToMaster.


Within OnConnectedToMaster you could try to join an existing room or create your own. The following code snippets show possible method calls to start or join games.

When friends want to play together and have a way to communicate outside of PUN (e.g. with Photon Chat, Facebook), they can make up a room name and use JoinOrCreateRoom. If nobody else should be matched into this room, make it invisible for matchmaking:

With JoinOrCreateRoom, the room gets created if it doesn't exist, so it doesn't matter who is first. If it's full, OnPhotonJoinRoomFailed gets called (if you implemented it somewhere).

Read more about matchmaking in our guide.

Game Logic

GameObjects can be Instantiated as "networked GameObjects", which have a PhotonView component. This identifies the object and the owner (or controller). The player who's in control, updates everyone else. Continuous updates can be sent by attaching a script into the Observed field of a PhotonView. The script must implement OnPhotonSerializeView like this:

Clients can do Remote Procedure Calls on specific networked objects for anything that happens infrequently:

Independent from GameObjects, you can also send your own events:

Read more about PUN's RPCs and RaiseEvent.

Demos and Tutorials

In the PUN packages, you find several demos and useful scripts, which you can reuse and or dissect and redo.

To get properly started, take your time to read and code the "PUN Basics Tutorial".

 To Document Top