public static void SettingPlayer() { RefreshAllScene(true); string[] scenesNamseList = scenesName.Split('\\'); string[] sceneNamesList_Right = scenesNamseList[scenesNamseList.Length - 1].Split('/'); string sceneNamesLis_Right_Left = sceneNamesList_Right[sceneNamesList_Right.Length - 1].Replace(".unity", ""); string folderName = sceneNamesList_Right[sceneNamesList_Right.Length - 1].Replace(".unity", "");//文件夹的名字 int num = sceneNamesLis_Right_Left.IndexOf(".") + 1; sceneNamesLis_Right_Left = sceneNamesLis_Right_Left.Substring(num); PlayerSettings.productName = sceneNamesLis_Right_Left; string path = pathX + (folderName) + @"\" + (sceneNamesLis_Right_Left) + ".exe"; //每个场景都有一个单独的文件夹 //string path = pathX + (sceneNamesLis_Right_Left) + ".exe"; //所有场景都在一个文件夹 BuildReport report = BuildPipeline.BuildPlayer(GetBuildScenes(), path, BuildTarget.StandaloneWindows, BuildOptions.None); BuildSummary summary = report.summary; if (summary.result == BuildResult.Succeeded) { Debug.Log("完成"); BwPostProcess.SettingStop(); } path = ""; }
标签:sceneNamesLis,Right,string,一键,Unity,exe,path,sceneNamesList,Left From: https://www.cnblogs.com/zqiang0803/p/18530554