using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Rendering.Universal
{
///
/// You can add a ScriptableRendererFeature to the ScriptableRenderer. Use this scriptable renderer feature to inject render passes into the renderer.
///
///
///
[ExcludeFromPreset]
[MovedFrom("UnityEngine.Rendering.LWRP")] public abstract class ScriptableRendererFeature : ScriptableObject
{
[SerializeField, HideInInspector] private bool m_Active = true;
///
/// Returns the state of the ScriptableRenderFeature (true: the feature is active, false: the feature is inactive). Use the method ScriptableRenderFeature.SetActive to change the value of this variable.
///
public bool isActive => m_Active;
///
/// Initializes this feature's resources. This is called every time serialization happens.
///
public abstract void Create();
///
/// Injects one or multiple ScriptableRenderPass in the renderer.
///
/// List of render passes to add to.
/// Rendering state. Use this to setup render passes.
public abstract void AddRenderPasses(ScriptableRenderer renderer,
ref RenderingData renderingData);
void OnEnable()
{
Create();
}
void OnValidate()
{
Create();
}
///
/// Sets the state of ScriptableRenderFeature (true: the feature is active, false: the feature is inactive).
/// If the feature is active, it is added to the renderer it is attached to, otherwise the feature is skipped while rendering.
///
/// The true value activates the ScriptableRenderFeature and the false value deactivates it.
public void SetActive(bool active)
{
m_Active = active;
}
}
}