unity命令行打包

更新时间:2023-05-16 04:08:41 阅读: 评论:0

unity命令⾏打包
贵州特产小吃本来是没想⽤这个命令⾏Build⽅式,可惜电脑不知道怎么的就没法可视化的Build的了。。⼀Build就蓝屏。
后⾯发现这个命令⾏Build还是⼀个很实⽤的东西,⽐如你可以在服务器上搞个脚本让它每天在深更半夜时帮你⾃动Build⼀个脚本。上Google查了⼀些资料:
信访维稳工作方案build成IOS的脚本。
Unity Command Line参数:
Build有错误,要注意看Editor.log:
1.要写⼀个脚本。
政治思想方面要调⽤BuildPipeline这个类的BuildPlayer这个⽅法来实现的。
有关这个类的⽤法:
我编译android的apk时的代码:
/**
/Applications/Unity/Unity.app/Contents/MacOS/Unity\
-batchmode \
-quit \
-projectPath $PROJECT_PATH \
-executeMethod CommandBuild.BuildAndroid
*/
// Asts/Editor/CommandBuile.cs
using UnityEngine;
using UnityEditor;
public class CommandBuild
{
public static void BuildAndroid()
香港消费水平{
string[] levels = {"Asts/Scene/1.unity","Asts/Scene/2.unity"};
BuildPipeline.BuildPlayer(levels, "Sample.apk",BuildTarget.Android, BuildOptions.None);
}
}
2.在命令⾏中不开启Unity调⽤1中写的⽅法:
先进到的⽬录下,然后在打命令。
C:\programfiles\Unity\Editor& -quit -batchmode -executeMethodCommandBuild.BuildAndroid
具体参数命令可以看:
添加:类说明
有关这个类的⽤法:
BuidPipeline.BuildPlayer女娲造人教案
勃兴public static stringBuildPlayer(string[]levels,stringlocationPathName,target,options);
参数:
levels: 需要buid哪些scenes
locationPathName:  build的包的路径及名称
target: 是BuildTarget类型,BuildTarget.Android编译⼀个安卓平台包,这是选择平台的
options: 是BuildOptions,类似于在使⽤unity界⾯build的时候,出现的右侧选择,例如:Development版本;⼀般选择None,按默认进⾏
返回值:
String类型,如果打包出错了,则返回错误信息
Description:
可能遇到的问题:
错误提⽰:
Error building Player:UnityException: Bundle Identifier has not been t up correctly
Plea t the Bundle Identifier in the Player Settings. The value must followthe convention
'com.YourCompanyName.YourProductName' and can containalphanumeric characters and underscore.
Each gment must not start with a numeric character or underscore.
根据提⽰我们知道需要设置Bundle Identifier。
手工绣花图案
打开File=>build ttings=> player ttings=>属性⾯板找到Bundle Identifier 设置下名称,格式为:
小的时候com.YourCompanyName.YourProductName
设置好重新发布即可

本文发布于:2023-05-16 04:08:41,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/649383.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:选择   命令   设置   知道   出错   打包   名称
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图