Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


StylePropertyAttribute

Binds a field or property of a component struct to a custom USS property.
Read time 3 minutesLast updated 6 days ago

Definition

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field, Inherited = false)]public class StylePropertyAttribute : Attribute

Remarks

Apply this attribute to a field or property of a struct that has the VisualElementComponentAttribute. The member receives the value of the custom USS property resolved on the element the component is attached to, so a style sheet can drive component data.

Fields

Value

Description

nameThe custom USS property name, for example
"--my-color"
.

Constructors

Constructor

Description

StylePropertyAttribute(System.String)Initializes a new instance of the StylePropertyAttribute class.

Inheritance

Inherited Members