Photon Fusion 2

Explore how to host Unity projects on Edgegap using techniques from the Fusion 2 Asteroids Samplearrow-up-right.

βœ”οΈ Preparation

Before we start, you will need:

⚑ Deploy and Connect

1. Deploy a Server on Edgegap

β˜‘οΈ To get started, you'll need to create a free account with Edgegaparrow-up-right. No credit card required.

β˜‘οΈ Create a new app version for your applicationarrow-up-right, choose Fusion 2 Asteroids Sample.

β˜‘οΈ Open your new project in Unity.

β˜‘οΈ Navigate to Tools / Edgegap Hosting, then to step 6. Deploy a Server on Edgegap.

β˜‘οΈ Press Deploy to cloud and open your new deployment's detailsarrow-up-right.

β˜‘οΈ Find your deployment's unique, one-time connection details:

  • Host URL in format 780aa4260e83.pr.edgegap.net .

βœ… You may now proceed to the next step.

2. Connect from Editor

β˜‘οΈ Open your new project in Unity.

β˜‘οΈ Press the ▢️ Play button to start your game client.

β˜‘οΈ Input Host URL (connection details from previous step) as room name.

β˜‘οΈ Press Start Edgegap button to connect to your server.

β˜‘οΈ Connect a second virtual Player with Multiplayer Play Modearrow-up-right or ParrelSyncarrow-up-right.

πŸ™Œ Congratulations on your first Deployment on Edgegap!

✏️ Customize Server Build

circle-check

Create an App on Photon

circle-info

To make the initial demo easy, we used a free tier Photon Cloud account owned by Edgegap.

β˜‘οΈ Create a free account with Photonarrow-up-right.

β˜‘οΈ Create an Application on Photonarrow-up-right:

  • Multiplayer Game,

  • Fusion Photon SDK,

  • Fusion 2 SDK version.

β˜‘οΈ Find your Application ID in format 85314a99-56fc-4ab3-ba26-50efca09f303 .

β˜‘οΈ Input your ID in Photon Settings under Tools / Fusion / Fusion Hub (Alt + F).

Integrate Fusion 2 Project with Edgegap

circle-check
circle-exclamation

Game clients will connect to game servers through Photon Fusion 2 arrow-up-rightSession (room) arrow-up-rightfeaturearrow-up-right.

Your game server needs to register it's IP address and external port with the Session name, when calling _runnerInstance.StartGame(StartGameArgs args):

  • use GameMode.Server to ensure your connection isn't relayed over Photon Cloud (adds latency),

  • use NetAddress.CreateFromIpPort method from Fusion,

  • provide server's IP address: Environment.GetEnvironmentVariable("ARBITRIUM_PUBLIC_IP")

  • provide server's external port: Environment.GetEnvironmentVariable("ARBITRIUM_PORT_GAMEPORT_EXTERNAL")

Use Edgegap Deployment Host URL as a Session name:

Troubleshooting

chevron-rightGame Does Not Exist (32758)hashtag
  • Photon rooms require the player to be connecting to the Photon Cloud region where the deployment is located. Deploying from dashboard uses a randomized player IP.

  • You may need to find the deployment's location on the map, and configure your game client in Assets / Photon / Fusion / Resources / PhotonAppSettings.asset with the matching Photon Cloud regionarrow-up-right.

  • Edgegap deploys as close to the player as possible when using our plugins or API so in production, setting Photon Cloud region is not required.

Last updated

Was this helpful?