Photon Unity Networking 2 2.45

Main Page

Introduction

Photon is a real-time multiplayer game development framework that is fast, lean and flexible. Photon consists of a server and multiple client SDKs for various use cases, programming languages and engines.

Note

As of 2023, PUN 2 is in "maintenance mode" or "long term support mode". Major updates or support for new Unity versions beyond 2022.x are not planned. We came to the conclusion that fixing the shortcomings of PUN would lead to a new API overall. This led to creating the newer and improved Fusion SDK.

About PUN

Photon Unity Network (PUN) is our take on a Unity specific, high-level solution: Matchmaking, easy to use callbacks, components to synchronize GameObjects, Remote Procedure Calls (RPCs) and similar features provide a great start. Beyond that is a solid, extensive API for more advanced control.

Full source code is available, so you can scale this package to support any type of multiplayer game you come up with.

This package is compatible with the managed Photon Cloud service, which runs Photon Servers for you. A setup window registers you (for free) in less than a minute.

Most notable features:

  • Dead-easy API
  • Lots of demos and an extensive PUN Basics Tutorial
  • Server available for self hosting (requires Enterprise plan)
  • Load-balanced! Scales across a variable number of servers
  • Outstanding performance of the Photon Server
  • Dedicated servers. No NAT punch-through needed
  • Offline mode: re-use your multiplayer code in singleplayer game modes

Documentation And Learning

There is an Online Documentation, which is considered a manual for PUN. This might become your primary source for information.

This is the Reference Documentation for PUN. It summarizes the most important classes in the Public API module and explains each class, method and field individually. This is generated from the source of PUN and should be used to look up details on usage and parameters.

Aside from that, there are also Demos in the PUN package itself and a PUN Basics Tutorial online, which you should check out.

First Steps

Import PUN into a new, empty project. Register via the pop up "wizard" (ALT+P) to get you a free Photon Cloud subscription (saving an initial AppId for you). Now you're ready to run and dissect the Demos.

Make sure to open and code the PUN Basics Tutorial.