Пример #1
0
        // Upgrade project folders and move anything to correct location
        static void UpgradeProject()
        {
            // Move materials into a resources folders so that they are found in runtime generation
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", materialsFolder, materialsFolder + "/Resources", "LBMoon.mat");
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", materialsFolder, materialsFolder + "/Resources", "LBTerrain.mat");

            #if SCSM_SSC
            // If Sci-Fi Ship Controller is installed first, LBStar.mat exists in a non-resource folder in SSC.
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", "Assets/SCSM/SciFiShipController/Demos/Materials/Environment", materialsFolder + "/Resources", "LBStar.mat");
            // Move stars into resources folder so that celestials get built at runtime correctly
            LBEditorHelper.CheckFolder(modelsFolder);
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", "Assets/SCSM/SciFiShipController/Demos/Models/Environment", modelsFolder + "/Resources", "StarLowPolyFBX.fbx");
            #else
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", materialsFolder, materialsFolder + "/Resources", "LBStar.mat");
            // Move stars into resources folder so that celestials get built at runtime correctly
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", modelsFolder, modelsFolder + "/Resources", "StarLowPolyFBX.fbx");
            #endif


            // Move the shaders into a resources folder
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", shadersFolder, shadersFolder + "/Resources", "LBTerrain-Base.shader");
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", shadersFolder, shadersFolder + "/Resources", "LBTerrain-AddPass.shader");
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", shadersFolder, shadersFolder + "/Resources", "LBTerrain-FirstPass.shader");

            // v1.3.5
            if (File.Exists(shadersFolder + "/" + "LBWeatherFX.shader") || File.Exists(shadersFolder + "/Resources/" + "LBWeatherFX.shader"))
            {
                Debug.LogWarning("WARNING: Landscape Builder - LBWeatherFX was replaced in v1.3.5 with LBImageFX - please consult the manual or contact support");
            }

            if (File.Exists(shadersFolder + "/" + "LBSimpleSSRR.shader"))
            {
                Debug.LogWarning("WARNING: Landscape Builder - LBSimpleSSRR was replaced in v1.3.5 with LBImageFX - please consult the manual or contact support");
            }

            // If the Designers are in the wrong folder, move them
            #if LB_EDITOR
            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", scriptsBehavioursFolder, scriptsDesignersFolder, "LBGroupDesigner.cs");
            #endif

            LBEditorHelper.MoveAsset("LBSetup.UpgradeProject", scriptsBehavioursFolder, scriptsDesignersFolder, "LBStencilBrushPainter.cs");

            // LB 2.0.4 may have incorrectly created a Material folder in Demo Scene\Models
            if (Directory.Exists(demosceneFolder + "/Models/Materials"))
            {
                if (AssetDatabase.DeleteAsset(demosceneFolder + "/Models/Materials"))
                {
                    Debug.Log("INFO: Landscape Builder - Removed legacy " + demosceneFolder + "/Models/Materials folder");
                }
            }

            // LB 2.2.0 Support for multiple SRP versions
            LBEditorHelper.RenameAsset("LBSetup.UpgradeProject", lbFolder + "/SRP", "LB_LWRP.unitypackage", "LB_LWRP_4.0.1.unitypackage");
            LBEditorHelper.RenameAsset("LBSetup.UpgradeProject", lbFolder + "/SRP", "LB_HDRP.unitypackage", "LB_HDRP_4.9.0.unitypackage");

            // LB 2.2.1 If the SRP version-based packages where imported, the rename above would not have updated original packages
            LBEditorHelper.DeleteAsset("LBSetup.UpgradeProject", lbFolder + "/SRP", "LB_HDRP.unitypackage");
            LBEditorHelper.DeleteAsset("LBSetup.UpgradeProject", lbFolder + "/SRP", "LB_LWRP.unitypackage");
        }