프로그래밍/Jenkins

젠킨스 라이트맵 빌드 세팅

JinFluenza 2019. 3. 18. 11:14

 //매개변수 처리

        string[] args = System.Environment.GetCommandLineArgs();


        if (args.Length <= 0) return;


        string sceneParams = args[args.Length - 1];


        //매개변수에서 씬 이름 분리

        string[] sceneNames = sceneParams.Split(',');


        //번들 폴더에서 .unity 확장자로된파일 찾아서 경로 반환

        string[] path = Directory.GetFiles(Application.dataPath + "/Bundle", "*.unity", SearchOption.AllDirectories);



        for (int i = 0; i < path.Length; i++)

        {

            for (int j = 0; j < sceneNames.Length; j++)

            {

                //대소문자 판별 안하도록 수정하면 좋을듯

                if (path[i].Contains(sceneNames[j]) == true)

                {

                    Debug.Log($"Build LightMap : {sceneNames[j]}");


                    EditorSceneManager.OpenScene(path[i], OpenSceneMode.Single);

                    LightmapEditorSettings.textureCompression = true;

                    Lightmapping.Bake();

                    continue;

                }

            }


        }