Photon Fusion Setup Guide
-
Go to Unity Asset Store to https://assetstore.unity.com/packages/tools/network/photon-fusion-267958 to import Fusion package into your unity project.
-
Download META All-in-One Sdk https://assetstore.unity.com/packages/tools/integration/meta-xr-all-in-one-sdk-269657 and imported into your folder
-
Go to Photon Wesbite to create a account and go to Dashboard and hit Create new App
-
If you cant locate this dashboard go to Asset/Photon/Fusion/Resources/PhotonAppsetting.Paste both the app ID and voice ID there and set the Region to US.
-
Simple Grabbable Scene (using Meta Building Blocks) # what we showed on 10/02
Drag the basic camera rig, interaction rig, and AutoMatching Manager into the scene.
Create a cube and add the Grabbable component from the Interaction SDK.
Assign Network Object, Network Transform, TransferOwnership Fusion, and TransferOwnership OnSelect to make the cube grabbable by two players over the network.
Example: one player can grab the cube, and the other player will see the cube being grabbed; another player can also grab the cube directly from someone else’s hand.
Note: gravity is not synchronized over the network. If one player grabs the cube from another player’s hand, there may be a visible offset — this offset only appears locally to that player
Link for Input Binding namespaces: https://docs.unity3d.com/6000.2/Documentation/Manual/xr_input.html
Setup Video: https://youtu.be/efkZcpERcHs
- Network Transform / Network Mecanim Animator auto-syncs basics (position, rotation, scale, animations).
- RPCs send small, custom messages (e.g.,
bool,int,float,string,Color) so every client runs the same update. - Docs: Photon Fusion RPCs
A cube changes to a player’s assigned color whenever that player points/touches it — and everyone sees the change.
- Create the cube (optional: assign a default material).
- Add ray interaction:
Interaction SDK→ Add Ray Grab Interaction → Fix All → Create. - Network it: Ensure the cube has a NetworkObject component and check Allow State Authority Override.
- Add scripts/components:
- Interactable Unity Event Wrapper (exposes hover/select events).
- NetworkInteractableUnityEventWrapper.cs (inherits
Fusion.NetworkBehaviour). You can get this script from the.zipfile that I shared with you on Slack. - In the Inspector, go to
NetworkInteractableUnityEventWrappercomponent and:- Set Ray Interactable → child
ISDK_RayGrabInteractionfrom the interactable cube that you just created (or drag and drop this gameobject). - Set Target Renderer → cube’s
MeshRenderer(or simply drag and drop the cube gameobject). - (Optional) A UI text field for on-cube tips. Feel free to comment out line 15 and 80 from the
NetworkInteractableUnityEventWrapper.csscript if you do not want to use the text field. I used it for guiding the players about how to interact with the cube. Feel free to open theGrabbable + Interactable Cubes with Better Avatar Sceneand expand theInteractable Cubeto see the canvas where I created a UIText Mesh Protext game object. I dragged and dropped this text game object in the text field of the script.
- Set Ray Interactable → child
- On hover start: temporarily take ownership → look up the player in a dictionary.
- If new: generate a random color and store
{playerId → color}. - Apply that color locally, then send an RPC so others mirror the change.
- If new: generate a random color and store
- On hover end: release ownership.
[Rpc(RpcSources.All, RpcTargets.All)]
public void RpcSetColor(Color color) { /* apply color */ }All— any player can call / everyone receivesInputAuthority— the player currently controlling the objectStateAuthority— the player who currently owns the object’s state
In Shared GameMode, All → All is a safe default for this use case (adjust if your GameMode differs).