美文网首页unity
Unity 命令行

Unity 命令行

作者: 呢喃_0412 | 来源:发表于2022-04-02 14:58 被阅读0次

    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 命令行

        本文链接:https://www.haomeiwen.com/subject/zdmtsrtx.html