1. Setting up Photon Unity Networking
In this tutorial, we learn how to get ready for creating a shared experience by importing Photon Unity Networking (PUN) into your Unity project. Photon is one of several networking options available to Mixed Reality developers to create shared experiences. We we will learn how to create a Photon account, import Photon, and create an optional local server
Learn how to create a Photon account
Learn how to find and import Photon Unity Networking
Set up a local Photon server
Setting up Photon
- Set up a Photon account. Navigate to the Photon Sign-up page by clicking on this link. Follow the instructions on the sign-up page to create the account.
- Create an application ID by clicking the Create a New App button.
- Select Photon PUN from the dropdown menu under Photon Type. Then give it a name. In this example, we named it HoloLensPhotonProject. Once finished, click the Create button.
- Once that is done, return to your applications page and you should see something similar to the picture below. Click on the application ID and copy it. Paste it somewhere you can easily access.
Create a new unity project and name it HLSharingProject. For instructions on how to create a new Unity project, please refer to the Base Module's "Create Unity Project" section.
Once the project loads, click on the Assets Store tab, as shown in the image below. Then, in the search box highlighted in the image below, type in PUN, and select the Photon PUN 2 - FREE" asset from the search results.
- Download and import this asset by pressing the Download and Import buttons.
Once Photon has completed the importing process, the Pun Wizard appears. Take the application ID (which should be in your clipboard) from step 4, and paste it into the AppID box, and press the Setup Project button.
After successfully adding the AppID, navigate to Photon->PhotonUnityNetworking ->Resources->PhotonServerSettings in Assets. Select the Use Name Server option, and set the fixed region to US or your photon service region.
You have successfully created a Photon account, set up a local Photon server, and imported PUN into Unity. Your next step is to set up the project and then allow connections with other users so that multiple users can see your work.