Description
The LayerType
property of the Graphics
class provides information about the current rendering layer type. This property is useful for determining whether the current rendering context is meant for drawing opaque, transparent, or shadow elements. While most of the time you may not need to interact with this property directly, it is available for situations where understanding the rendering layer is necessary.
Usage
To access the current layer type, simply use the Graphics.LayerType
property. This property is static and can be accessed without instantiating the Graphics
class.
Example
// Example of accessing the LayerType property
SceneLayerType currentLayerType = Graphics.LayerType;
// Use the currentLayerType to make decisions based on the rendering context
if (currentLayerType == SceneLayerType.Opaque)
{
// Perform operations specific to opaque rendering
}
else if (currentLayerType == SceneLayerType.Transparent)
{
// Perform operations specific to transparent rendering
}
else if (currentLayerType == SceneLayerType.Shadow)
{
// Perform operations specific to shadow rendering
}