Exemplo n.º 1
0
    private void Start()
    {
        if (gameHoster == null)
        {
            switch (stack)
            {
            case NETWORKINGSTACK.MLAPI:
                UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects()
                .First(p => p.name == "NetworkManagerMLAPI").SetActive(true);
                gameHoster = GameObject.Find("NetworkManagerMLAPI").GetComponent <GameHoster>();
                if (Application.isBatchMode)
                {
                    gameHoster.CreateStandaloneServer();
                }
                break;

            case NETWORKINGSTACK.COLYSEUS:
                UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects()
                .First(p => p.name == "NetworkManagerColyseus").SetActive(true);
                gameHoster = GameObject.Find("NetworkManagerColyseus").GetComponent <GameHoster>();
                break;
            }
        }

        if (Application.isBatchMode)
        {
            Application.targetFrameRate = 30;
            Debug.Log("I'm in batch mode and will start standalone server");
            gameHoster.CreateStandaloneServer();
        }

#if UNITY_SERVER
        Debug.Log("I'm a Unity server build ! ");
#endif
    }
Exemplo n.º 2
0
    private void Start()
    {
        if (gameHoster == null)
        {
            switch (stack)
            {
            case NETWORKINGSTACK.MLAPI:
                UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects()
                .First(p => p.name == "NetworkManagerMLAPI").SetActive(true);
                gameHoster = GameObject.Find("NetworkManagerMLAPI").GetComponent <GameHoster>();
                break;

            case NETWORKINGSTACK.COLYSEUS:
                UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects()
                .First(p => p.name == "NetworkManagerColyseus").SetActive(true);
                gameHoster = GameObject.Find("NetworkManagerColyseus").GetComponent <GameHoster>();
                break;
            }
        }
    }