spheregen logo on transparent background

Photon for Networking in XR Applications

team collaborating on hologram with hololens 2

At SphereGen, one of our core expertise lies in building cross-platform XR applications. These applications facilitate real-time collaboration and interaction among multiple users within shared virtual environments. For our development process, we rely on Photon, a reliable and feature-rich networking middleware solution that supports various platforms. Unity, our preferred design platform for XR, accommodates these applications.

In this article, we will delve into the key considerations for developing robust multi-user XR applications using Photon and Unity, focusing primarily on data synchronization across users.

Data Synchronization using Photon

Data synchronization is imperative to a solid interactive experience involving multiple users. It ensures that certain pieces of information are the same for all users. Good data synchronization makes the experience feel grounded and “real,” especially when the intent of your application is for users to interact and collaborate. Without data synchronization, users cannot properly collaborate or even be sure that they are viewing the same content. Data synchronization keeps all users tied to the same shared environment, allowing them to see changes made by others and for their changes to be visible to others.

Design Considerations

Realtime updates

An example is certain objects’ transform (position, rotation, scale). If a user moves, rotates, or scales an object, this may need to be reflected in real-time for every other user. So, for that object, the application needs to send updates numerous times a second about the object’s position, rotation, and scale.

Event or State updates

An example of this is when a user makes a decision that changes the behavior of the entire application or when a user joins a collaborative session. Suppose a user decides to load a model. That user should send a message over the network to inform all other users that they should load the same model. Then, the logic for loading the model happens locally for all users independently of each other. Another prime example of this type of synchronization is when a user joins a collaborative session that is in process and needs to have their application state synchronized with the other users’ application state. The synchronization is a one-time event to set up for that newly joined user. Afterward, other real-time or event updates will keep them in sync.

Local functionality

Examples of local functionality are parts of the application that don’t need to synchronize for all users. Things like UI position and placement fall into this category, as you may want users to be able to modify or reposition UI elements without affecting other users.

Once you’ve determined which parts of your application need their information synchronized and how frequently, you can explore Photon’s options.

The Photon Components

Now, we’ll explore the Photon Components that we can use to support the different design needs of a networked application. Listed in order of complexity, from simple to complex, we will briefly explore the following components: PhotonView, Photon Remote Procedure Calls (RPCs), Photon Events and Photon Serialization. Let’s examine each of these in sequence and explain why they are helpful.

PhotonView Component

Definition: The PhotonView is a fundamental component in Photon’s Unity integration. It’s attached to GameObjects to mark them as relevant for network synchronization.

Use Case: It primarily synchronizes object states across the network. For example, in a multi-user XR environment, if a user moves a virtual object, the PhotonView component ensures that this action reflects all users’ views in real time. It’s essential for ensuring consistency in the shared virtual environment. Using this component lets you easily ensure that a given object is in sync with all users regarding its position, rotation, and scale.

Photon Remote Procedure Calls (RPCs)

Definition: RPCs in Photon are methods you can call locally, but they are executed remotely on other clients connected to the same room.

Use Case: RPCs are ideal for immediate actions or events, such as a user performing an action that needs to be reflected to all other users immediately. For example, if a user picks up a virtual tool in an XR application, you can use an RPC to show that tool as being used by that user across all connected clients.

Photon Events

Definition: Photon Events are custom events you can define and use to send client messages or data.

Use Case: They are more flexible than RPCs and useful for less frequent but significant state changes or information broadcasts. For instance, if a user changes the environment settings in an XR application, a Photon Event can be dispatched to update all users about this change.

Photon Serialization

Definition: Serialization in Photon involves converting object data into a format that can be transmitted over the network and then reconstructed on the receiving end.

Use Case: This is crucial for synchronizing complex data or object states that can’t be handled easily by the other options. For example, serialization can be used to sync the progress of a collaborative task in an XR application, ensuring that all users are aware of the current state of the task. Another example we have used Photon Serialization for is to provide real-time updates of all the joints of a user’s hands so that everyone in a collaboration session can see not only the location of a user’s head and their gaze direction, but also their hands and what they are reaching for or pointing.


Photon’s compatibility with Unity and its wide range of networking components offer a comprehensive solution for the complex challenge of data synchronization in multi-user scenarios.

For successful collaborative environments, effective data synchronization strategies are crucial. Photon provides a suite of tools – PhotonView, Photon Remote Procedure Calls (RPCs), and Photon Events – each catering to data synchronization and state management aspects. These tools address the critical need for reliable data synchronization, ensuring a smooth, realistic, and engaging user experience.

These components dramatically enhance the user experience in XR applications. Real-time updates of object positions and states, an immediate reflection of user actions, and accurate synchronization of complex data and events contribute to a more engaging, realistic, and collaborative environment, fostering a sense of presence and immersion while facilitating effective collaboration, communication, and interaction among users in shared virtual spaces.

Understanding and leveraging these Photon components for businesses exploring XR applications is a steppingstone toward creating high-quality, engaging, and seamless multi-user experiences. As XR technologies evolve, mastering these tools will be increasingly important in delivering cutting-edge virtual experiences that meet the growing demands of users and industries alike.

About SphereGen

SphereGen logo on white backgroundSphereGen is a unique solutions provider that specializes in cloud-based applications, Intelligent Automation, and Extended Reality (AR/VR/MR). We offer full-stack custom application development to help customers employ innovative technology to solve business problems.

Learn more about what we do in XR: https://www.spheregen.com/extended-reality

SphereGen logo on white backgroundSphereGen is a unique solutions provider that specializes in cloud-based applications, Intelligent Automation, and Extended Reality (AR/VR/MR). We offer full-stack custom application development to help customers employ innovative technology to solve business problems.

Learn more about what we do in XR: https://www.spheregen.com/extended-reality

microsoft partner badge       uipath silver partner badge