Class VolumeComponentEditor
A custom editor class that draws a Volume
Inherited Members
Namespace: UnityEditor .Rendering
Assembly: Unity.RenderPipelines.Core.Editor.dll
Syntax
[CustomEditor(typeof(VolumeComponent), true)]
public class VolumeComponentEditor : Editor
Examples
Below is an example of a custom Volume
using UnityEngine.Rendering;
[Serializable, VolumeComponentMenu("Custom/Example Component")]
public class ExampleComponent : VolumeComponent
{
public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
}
And its associated editor:
using UnityEditor.Rendering;
[CustomEditor(typeof(ExampleComponent))]
class ExampleComponentEditor : VolumeComponentEditor
{
SerializedDataParameter m_Intensity;
public override void OnEnable()
{
var o = new PropertyFetcher<ExampleComponent>(serializedObject);
m_Intensity = Unpack(o.Find(x => x.intensity));
}
public override void OnInspectorGUI()
{
PropertyField(m_Intensity);
}
}
Fields
Name | Description |
---|---|
m_Inspector | A reference to the parent editor in the Inspector. |
Properties
Name | Description |
---|---|
active |
The serialized property of active for the component being inspected. |
base |
The copy of the serialized property of the Volume |
expanded | If the editor for this Volume |
has |
Override this property if your editor makes use of the "Additional Properties" feature. |
show |
Set to true to show additional properties. |
volume | Obtains the Volume that is being edited from this volume component |
volume |
Specifies the Volume |
Methods
Name | Description |
---|---|
Begin |
Start a scope for additional properties. This will handle the highlight of the background when toggled on and off. |
Draw |
Draws a header into the inspector with the given title |
Draw |
Draws the override checkbox used by a property in the editor. |
End |
End a scope for additional properties. |
Get |
Sets the label for the component header. Override this method to provide a custom label. If you don't, Unity automatically obtains one from the class name. |
On |
Unity calls this method when the object goes out of scope. |
On |
Unity calls this method when the object loads. |
On |
Unity calls this method each time it re-draws the Inspector. |
Property |
Draws a given Serialized |
Property |
Draws a given Serialized |
Repaint() | Triggers an Inspector repaint event. |
Unpack(Serialized |
Generates and auto-populates a Serialized |