float Opacity { get; set; }

robot_2Generated
code_blocksInput

Description

The Opacity property of the BrushSettings class in the Editor.TerrainEditor namespace represents the transparency level of the brush used in terrain editing. This property is a float value that determines how opaque or transparent the brush effect will be when applied to the terrain.

Usage

To adjust the opacity of the brush, set the Opacity property to a value between 0 and 1. A value of 0 means the brush is fully transparent, while a value of 1 means it is fully opaque. The property supports incremental adjustments with a step of 0.01.

Example

// Example of setting the Opacity property
BrushSettings brushSettings = new BrushSettings();

// Set the brush opacity to 50%
brushSettings.Opacity = 0.5f;

// Ensure the opacity is within the valid range
if (brushSettings.Opacity < 0 || brushSettings.Opacity > 1)
{
    throw new ArgumentOutOfRangeException("Opacity must be between 0 and 1.");
}