作用:多人在线服务器
获得App id
复制App id
可以取消Demos — 导入
添加App id — Setup Project
Photon - PhotonUnityNetworking - Resources - PhotonServerSettings 是编辑Photon连接的文件
App Version 版本为 1
PUN Logging 登录信息为full
命名为NetworkLauncher
创建C#脚本命名为Launcher 到Object空项目
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun
Public class Launcher : MonoBehaviourPunCallbacks
{
// Start is called before the first frame update
void Start()
{
PhotonNetwork.ConnectUsingSettings();
}
public override void OnConnectedToMaster()
{
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun//添加Photon.Pun
Public class Launcher : MonoBehaviourPunCallbacks//MonoBehaviourPunCallbacks是Photon.Pun的一个类
{
// Start is called before the first frame update
void Start()
{
PhotonNetwork.ConnectUsingSettings();//启用Photon连接文件来连接
}
public override void OnConnectedToMaster()//连接成功后做的事情
{
}
}