这里对我来说是一个全新的领域。我有一个局域网联网游戏,我想创建从连接的客户端远程重启我的UNET服务器的功能。寻找关于我开始研究的方法的一些反馈。这是正确思考的方法吗?谢谢!
[Server]
public void RestartServer()
{
StartCoroutine(DoRestartServer());
}
[Server]
IEnumerator DoRestartServer()
{
Debug.Log("Network Server Shut Down");
NetworkServer.Shutdown();
yield return new WaitForEndOfFrame();
Destroy(GameObject.FindGameObjectWithTag("NetworkManager"));
Debug.Log("Network Manager Shut Down");
yield return new WaitForSeconds(10.0f);
Instantiate(ForestGameManager.fgm.serverNetworkManagerPrefab);
Debug.Log("Network Manager Started Up");
yield return null;
}