Back to Writing
NOTESunityphotonpun2networkingtransform-sync

PUN2 (Photon Engine) - Transform Synchronization

October 9, 2020Updated Feb 17, 2026

![](

5Rh77q8VdWKC2PBkZwg.tAQfr1VMkJZiCS-s1vBlOjHo11eqAmU1Px1-H4ewHfQg.PNG.cdw0424/image.png?type=w966)

Transform synchronization with Photon Engine is straightforward.

![](

6AWbGKnAYrHPl0vRbgg.-fIycg3-5yuNhoLT0yDUP4FSQhIYsEi6JR7ptbaXyc0g.PNG.cdw0424/image.png?type=w966)

Prepare the object whose position you want to synchronize across the server.

For example, you'd typically have a character. Here, I'll use a Cube as the character.

![](

GgC9ZNpDPIfXXf1Iccg.Yzx_HzgyK46UwwaTalQIZgF_qoG0RwGOCYJSjkCfydMg.PNG.cdw0424/image.png?type=w966)

First, create and attach a script for controlling the character.

(Since this post is about Photon Engine, I won't go into the character control implementation.)

Then:

![](

Q0PvBF0bstwhzD2Ipgg.xr9ookcFL98ghsn9SCSGxlBPi1cz_lPkvcG91ae6TAkg.PNG.cdw0424/image.png?type=w966)

Click the AddComponent button, search for "Photon View," and add it.

Then:

![](

CtfNPssfFF6TmtSF2Eg.g1LVG4D5num0ZoV7GKKWOu9RNGov8sK_my5-8d3l104g.PNG.cdw0424/image.png?type=w966)

Search for "Photon Transform View" and add it as well.

After that, in the previously added Photon View:

![](

bclG2MA1Y1ouBmP01cg.u3yMWpK80zpoDWlFHaCpEwDJnKN8cX66nli2qSxaqZkg.PNG.cdw0424/image.png?type=w966)

You'll see that Photon Transform View is automatically referenced.

![](

9-S7VVJHue_EH5W_K8g.b-GXliKWFmlcnAHrZrMP4M9QmOD3ZwK74RipASv8m3Eg.PNG.cdw0424/image.png?type=w966)

Now select the synchronization options and open the controller.

![](

Ivjxl9R5qsrgj6zpFsg.8-XIYoZdxZdQFl_TSJ_HEIiIXKHdMBjEDt0JCLrqA-Ig.PNG.cdw0424/image.png?type=w966)

In this script, character control runs in FixedUpdate. Before movement begins, if this character wasn't spawned on the server through my own commands, it cannot be controlled.

This prevents the situation where you could control someone else's character, but on the actual screen the character would remain stationary, causing desynchronization.

If a character existed from the start, who owns it?

The answer is: the room owner. Since the room owner created the room, any characters initially placed in the room were also created by the room owner.

What happens if the room owner leaves?

Room ownership transfers to one of the remaining members, and the new room owner gains control.

In any case, by adding these two components and slightly modifying the script, you can immediately see synchronization working through the server.

If you're not satisfied with Photon Transform View and want to implement it yourself using only position and rotation values:

![](

vQQz2kIlQWlzYJ-DY0RsN5SsZLGBm0me0WSWO5nPQg.cRT9ZqFLvVHcpv6x1YPj2rMTUp35dq5x2_3J_dD24CMg.PNG.cdw0424/image.png?type=w966)

![](

sZLGBm0me0WSWO5nPQg.cRT9ZqFLvVHcpv6x1YPj2rMTUp35dq5x2_3J_dD24CMg.PNG.cdw0424/image.png?type=w966)

You can additionally inherit and implement the IPunObservable interface.

Write the logic, and you're done.

![](

xAMqXxm-Ix53CjEZNMg.bzVV7IUECP_Qb9tZhCPvAlbEcQP9-Sx8U0AHT6OvaHwg.PNG.cdw0424/image.png?type=w966)

![](

piEFC4D4i0qoABSbaUg.5lUa0rwsC9qDfW_IFovzxLSjlcQiHd6QYbUrsBo_B8Ug.PNG.cdw0424/image.png?type=w966)

The implementation logic records each value (as shown in the comments) and applies them locally.

That said, I personally think the built-in Photon components are sufficient unless you have a specific reason to do otherwise.


Note: This post wasn't written in great detail because it's primarily for my own records. I plan to create a separate, more thorough tutorial in the future.