示例#1
0
        void ResetServerConfig()
        {
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateInstance();

            m_config     = new MeshSyncServerConfig(projectSettings.GetDefaultServerConfig());
            m_serverPort = projectSettings.GetDefaultServerPort();
        }
示例#2
0
        /// <summary>
        /// Starts the server. If the server is already running, it will be restarted.
        /// </summary>
        public void StartServer()
        {
#if UNITY_STANDALONE || UNITY_EDITOR
            StopServer();

#if UNITY_EDITOR
            //Deploy HTTP assets to StreamingAssets
            DeployStreamingAssets.Deploy();
#endif
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateInstance();


            m_serverSettings.port = (ushort)m_serverPort;
            m_serverSettings.zUpCorrectionMode = (ZUpCorrectionMode)m_config.ZUpCorrection;

            m_serverStarted = Server.Start(ref m_serverSettings, out m_server);
            if (!m_serverStarted)
            {
                return;
            }

            m_server.fileRootPath = GetServerDocRootPath();
            m_server.AllowPublicAccess(projectSettings.GetServerPublicAccess());

            m_handler = HandleRecvMessage;

#if UNITY_EDITOR
            EditorApplication.update -= PollServerEvents;
            EditorApplication.update += PollServerEvents;
#endif
            if (m_config.Logging)
            {
                Debug.Log("[MeshSync] Server started (port: " + m_serverSettings.port + ")");
            }
#else
            Debug.LogWarning("[MeshSync] Server functions are not supported in non-Standalone platform");
#endif //UNITY_STANDALONE || UNITY_EDITOR
        }
示例#3
0
//----------------------------------------------------------------------------------------------------------------------

        #region Events
#if UNITY_EDITOR
        void Reset()
        {
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateInstance();

            m_config = new SceneCachePlayerConfig(projectSettings.GetDefaultSceneCachePlayerConfig());
        }