zoukankan      html  css  js  c++  java
  • 命令行给unity传参

    windows命令行与sh语法区别很大,注意下

    .bat脚本

    @echo on
    
    set UNITY3D_PROJECT_PATH=d:happyGitstareditor
    
    set UNITY3D_BUILD_METHOD=Build.Test
    
    echo %UNITY3D_PROJECT_PATH%
    
    D:softUnityEditor2019.3.13f1EditorUnity.exe -quit -batchmode -executeMethod %UNITY3D_BUILD_METHOD% -projectPath %UNITY3D_PROJECT_PATH% -logFile D:uild.log -uuu: something
    
    pause
    

     用空格区别参数

    unity c#

    public static void Test() 
        {
            string[] strs = System.Environment.GetCommandLineArgs();
    
    
            IoBuffer bi = new IoBuffer();
    
            foreach (var s in strs)
            {
               
                bi.PutString(s);
                
                if (s.Contains("-uuu:"))
                {
                    ///string arg = s.Split(':')[1];
                    //处理参数//
                    Debug.Log("gogogogogo--->s:"+s);
                    string a = "tx";
                    
                }
            }
    
            byte[] bs = bi.ToArray();
            WriteBytes2File("d://testCmd.txt", bs);
            bi.Clear();
        }
    

      

    string[] strs = System.Environment.GetCommandLineArgs();
    获取到的就是
    -quit
    -batchmode
    -executeMethod
    %UNITY3D_BUILD_METHOD%
    -projectPath
    %UNITY3D_PROJECT_PATH%
    -logFile
    D:uild.log
    -uuu:
    something

    另外生成的log build.log中可以看到c#的log
  • 相关阅读:
    织梦DEDEcms首页调用文档整篇内容
    dedecms专题列表页不显示标题的解决办法
    怎么让织梦文章按照权重排序
    Codeforces274B
    HDU5693
    HDU2476
    POJ3613
    「LibreOJ NOIP Round #1」旅游路线
    Educational Codeforces Round 48
    组合博弈学习笔记
  • 原文地址:https://www.cnblogs.com/nafio/p/12890186.html
Copyright © 2011-2022 走看看