Photon PUN 2
In order to use Photon PUN 2 in your project. You need to import the Photon PUN 2 package first from the asset store.
After this, go to the Edit Menu->Preferences. Humanoid Control will check the availability of the package and the Photon Networking option should appear in the Networking Support property:
When Photon Networking is selected for Networking Support, networking support components like the Networking Starter and Networking Transform should adapt automatically to Photon Networking.
The Grocery Store Networking demo scene will now support Photon Networking.
When using Photon PUN 2, the Networking Starter component has the following options:
|Networking Prefab||The player prefab which will be spawned across the network. This defaults to HumanoidPun for Photon Networking.|
|Room Name||The name of the environment shared by the players|
|Game Version||The version of the environment shared by the players|
|Send Rate||The number of updates per second communicated through the network.|
Self Hosted Networking
For local networking Photon PUN, go to the following page:https://www.photonengine.com/en-US/sdks#server-sdkserverserver. Then select ‘Server’:
And download the SDK.
Instructions on how to set it up can be found here: https://doc.photonengine.com/en-us/server/current/getting-started/photon-server-in-5min
The settings you need to use in Unity for Photon 2 are as follows:
In this case, we use a direct IP Address (localhost/127.0.01), so Use Name Server is disabled.
As the protocol is Udp, you need to set port to 5055. Other port numbers can be found here: https://doc.photonengine.com/en-us/realtime/current/connection-and-authentication/tcp-and-udp-port-numbers
If you start the scene now, Photon should connect to the local server.