找回密码
 立即注册
查看: 363|回复: 0

Unity 命令行

[复制链接]
发表于 2022-4-3 16:44 | 显示全部楼层 |阅读模式
1 运行程序,先cmd进入相应的unity 版本的安装目录下的Editor文件夹下。

1.1 unity.exe -projectPath xxx 打开xxx路径程序

1.2 unity.exe-buildTarget iOS 切换平台等等

1.3 unity xxx -executeMethod xxx.xx 调用程序的xx类的xx方法 方法必须是静态的,类必须要放在Editor下

1.4 unity -quit xxxx..... 是执行完完退出程序

1.5 重要点   GetCommandLineArgs

如何传递参数 其实很简单 直接在 后面跟上GetCommandLineArgs xxx参数就可

但是在unity中要用响应的方法接收

     String[] arguments= Environment.GetCommandLineArgs();

arguments []数组就是传递 的参数,

完整的例子:

unity.exe -quit -projectPath XXX -buildTarget Win64 -executeMethod 类名. 方法名 GetCommandLineArgs android

XXX是项目路径

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-9-22 15:33 , Processed in 0.097810 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表