Description
The PaintComponentIcon
method is a static extension method provided by the SceneExtensions
class in the Sandbox namespace. This method is used to render an icon for a component within a specified rectangular area on the screen, with a given opacity level. It is particularly useful for visualizing components in a scene editor or similar graphical interface.
Usage
To use the PaintComponentIcon
method, you need to provide the following parameters:
td
: A TypeDescription
object that describes the type of the component for which the icon is to be painted.
rect
: A Rect
structure that defines the rectangular area on the screen where the icon should be drawn.
opacity
: A float
value representing the opacity of the icon, where 1.0 is fully opaque and 0.0 is fully transparent.
This method does not return a value.
Example
// Example usage of PaintComponentIcon
TypeDescription componentType = new TypeDescription(typeof(MyComponent));
Rect iconRect = new Rect(10, 10, 32, 32); // x, y, width, height
float iconOpacity = 0.8f; // 80% opacity
SceneExtensions.PaintComponentIcon(componentType, iconRect, iconOpacity);