Public override void OnConnectedToMaster() Public class NetworkConnector : MonoBehaviourPunCallbacks We don’t need to worry about much else in there so let’s continue on to our connection code! Connecting to Photon ServersĬreate a C# script named ‘NetworkConnector.cs’ and input the following: using UnityEngine You can set this to Full if you’d like to see everything PUN is logging. We’d uncheck this if we were hosting our own multiplayer servers. Use Name Servers – Required for Photon Cloud.Users on different app versions won’t connect to each other’s rooms. You should set it to 1 until you need to make breaking changes to a live game. If we supported chat we could register a new app for Photon Chat If you didn’t paste in your AppId earlier, do it now. This is how Photon connects our users to the same server. If you open the server settings, you’ll notice a couple of options. In fact, we’re going to go there now and take a look. If you accidentally close this window, you can always find your PhotonServerSettings.asset by going to ‘Window -> Photon Unity Networking -> Highlight Server Settings.’ Once you’ve downloaded and imported the project is should ask for your app id. Open up the asset store in Unity and search for ‘PUN’ and the package should pop up. Now that we have our Photon App ID, we can create a new Unity project and import the PUN 2 – FREE asset. You should see something like this:Ĭlick on the App ID section like highlighted in yellow in the image above and copy the full string. Click the button and on the next page, choose ‘Photon PUN’ as the Photon Type, and name your app something like ‘PhotonTutorial.’ Click Create and you should be taken back to your applications list. Once you’ve confirmed your account and logged in, you’ll be taken to a dashboard with a Create A New App button. Go to the photon registration page, or search for Photon Unity and find your way to the registration form. In order to get a Photon App Id, we’ll need a photon account.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |