Class URPTerrainShaderSetting
A Graphics Settings container for settings related to terrain shaders in UniversalRenderPipeline.
Implements
Inherited Members
Namespace: UnityEngine.Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
[Serializable]
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
[CategoryInfo(Name = "Terrain Shader Inclusion Settings", Order = 50)]
[ElementInfo(Order = 10)]
public class URPTerrainShaderSetting : IRenderPipelineGraphicsSettings
Remarks
To change those settings, go to Editor > Project Settings in the Graphics tab (URP). Changing those settings through the API is only allowed in the Editor. In the Player, this raises an error.
Unity removes this container from Players at build time.
Examples
Here is an example of how to determine if your project has included terrain shaders when building a Player with URP.
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public static class URPTerrainShaderHelper
{
public static bool enabled
{
get
{
var gs = GraphicsSettings.GetRenderPipelineSettings<URPTerrainShaderSetting>();
if (gs == null) //not in URP or in a Player
return false;
return gs.includeTerrainShaders;
}
}
}
Properties
includeTerrainShaders
Controls whether terrain shaders are included in the build.
Declaration
public bool includeTerrainShaders { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
version
Indicates the current version of this settings container. Used exclusively for project upgrades.
Declaration
public int version { get; }
Property Value
Type | Description |
---|---|
int |