void GetAndSetActiveRenderPipelineSettings()
        {
            ToolboxHelper.RenderPipeline m_ActiveRenderPipeline = ToolboxHelper.GetRenderPipeline();
            m_VisualizationMaterial = AssetDatabase.LoadAssetAtPath <Material>("Packages/com.unity.terrain-tools/editor/terraintoolbox/materials/terrainvisualization.mat");

            switch (m_ActiveRenderPipeline)
            {
            case ToolboxHelper.RenderPipeline.HD:
                m_VisualizationMaterial.shader = AssetDatabase.LoadAssetAtPath <Shader>(k_HDRPShaderPath);
                break;

            case ToolboxHelper.RenderPipeline.Universal:
                m_VisualizationMaterial.shader = AssetDatabase.LoadAssetAtPath <Shader>(k_URPShaderPath);
                break;

            default:
                if (m_Terrains == null || m_Terrains.Count == 0)
                {
                    break;
                }
#if UNITY_2019_2_OR_NEWER
#else
                m_TerrainMaterialType = m_Terrains[0].materialType;
                if (m_TerrainMaterialType == Terrain.MaterialType.BuiltInLegacySpecular)
                {
                    m_TerrainLegacyShininess = m_Terrains[0].legacyShininess;
                    m_TerrainLegacySpecular  = m_Terrains[0].legacySpecular;
                }
#endif
                m_VisualizationMaterial.shader = Shader.Find("Hidden/Builtin_TerrainVisualization");
                break;
            }
        }
        void GetAndSetActiveRenderPipelineSettings()
        {
            ToolboxHelper.RenderPipeline m_ActiveRenderPipeline = ToolboxHelper.GetRenderPipeline();
            m_VisualizationMaterial = AssetDatabase.LoadAssetAtPath <Material>("Packages/com.unity.terrain-tools/editor/terraintoolbox/materials/terrainvisualization.mat");

            //Get terrains
            if (m_Terrains == null || GameObject.FindObjectsOfType <Terrain>().Length != m_Terrains.Count || m_Terrains[0] == null)
            {
                m_Terrains.Clear();
                m_Terrains.AddRange(ToolboxHelper.GetAllTerrainsInScene());
                m_Settings.TerrainMaxHeight = m_Terrains[0].terrainData.size.y;
            }

            //Get materials to revert to
            m_TerrainMaterials.Clear();
            foreach (Terrain terrain in m_Terrains)
            {
                m_TerrainMaterials.Add(terrain.materialTemplate);
            }

            switch (m_ActiveRenderPipeline)
            {
            case ToolboxHelper.RenderPipeline.HD:
                m_VisualizationMaterial.shader = Shader.Find("Hidden/HDRP_TerrainVisualization");
                break;

            case ToolboxHelper.RenderPipeline.LW:
                m_VisualizationMaterial.shader = Shader.Find("Hidden/LWRP_TerrainVisualization");
                break;

            default:
                if (m_Terrains == null || m_Terrains.Count == 0)
                {
                    break;
                }
#if UNITY_2019_2_OR_NEWER
#else
                m_TerrainMaterialType = m_Terrains[0].materialType;
                if (m_TerrainMaterialType == Terrain.MaterialType.BuiltInLegacySpecular)
                {
                    m_TerrainLegacyShininess = m_Terrains[0].legacyShininess;
                    m_TerrainLegacySpecular  = m_Terrains[0].legacySpecular;
                }
#endif
                m_VisualizationMaterial.shader = Shader.Find("Hidden/Builtin_TerrainVisualization");
                break;
            }
        }
Beispiel #3
0
        void GetAndSetActiveRenderPipelineSettings()
        {
            ToolboxHelper.RenderPipeline m_ActiveRenderPipeline = ToolboxHelper.GetRenderPipeline();
            switch (m_ActiveRenderPipeline)
            {
            case ToolboxHelper.RenderPipeline.HD:
                m_MaxLayerCount = kMaxLayerHD;
                break;

            case ToolboxHelper.RenderPipeline.LW:
                m_MaxLayerCount = kMaxNoLimit;
                break;

            default:
                m_MaxLayerCount = kMaxNoLimit;
                break;
            }
        }