Using Photon in Unity (network multiplayer online)

1. Apply for free PHOTON photon engine in China

photon official website address

1-1. Applying for an account

  1. Enter the official website, click Sign in in the upper right corner

insert image description here

  1. Log in

insert image description here

1-2. Application for APP

  1. Click CREATE A NEW APP

insert image description here

  1. Fill in the information

insert image description here

1-3. Apply for Free Photon Cloud in China

Apply for a free photon engine official website address in China

Go in and fill in the information, and it will be approved within 1-2 working days (generally it can be approved).

2. Using Photon in Unity

2-1. Download plug-in PUN2

  1. Download PUN2 in Asset Store

insert image description here

  1. Import to Unity, the PUN Setup interface will pop up, click Skip (fill in later)

insert image description here

  1. Find PhotonServerSettings

insert image description here

  1. Click PhotonServerSettings to fill in the information in the Inspector panel

insert image description here

a. Find the applied APP in the Photon personal homepage and fill it in the App Id PUN

insert image description here
b. Check Use Name Server
c. Fill in cn for Fixed Region
d. Fill in ns.photonengine.cn for Server

  1. Information after filling

insert image description here

3. Open the demo scene to check whether it can be connected online

3-1. Add the scene to Build Settings

insert image description here

3-2. Package (Build), open two windows for online

insert image description here

4. Final effect

insert image description here

Guess you like

Origin blog.csdn.net/My_csdnQMDX/article/details/126798786
Recommended