Пример #1
0
        public static void Run()
        {
            string pathToAssetServer     = Path.GetFullPath("Assets/Plugins/XAsset/Editor/AssetBundleServer.exe");
            string assetBundlesDirectory = Path.Combine(Environment.CurrentDirectory, "AssetBundles");

            KillRunningAssetBundleServer();

            BuildScript.CreateAssetBundleDirectory();

            string args = assetBundlesDirectory;

            args = string.Format("\"{0}\" {1}", args, Process.GetCurrentProcess().Id);
            ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(
                MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), GetMonoProfileVersion(),
                pathToAssetServer, args, true);

            startInfo.WorkingDirectory = assetBundlesDirectory;
            startInfo.UseShellExecute  = false;
            Process launchProcess = Process.Start(startInfo);

            if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0)
            {
                //Unable to start process
                Debug.LogError("Unable Start AssetBundleServer process");
            }
            else
            {
                //We seem to have launched, let's save the PID
                instance.m_ServerPID = launchProcess.Id;
            }
        }