View Attirbute
-
Create new class, for example
ExampleAttribute.cspublic class ExampleAttribute { } -
Inherit from
ViewAttributeclass.public class ExampleAttribute : ViewAttribute { } -
Optionaly add Required/Optional parameters.
public class ExampleAttribute : ViewAttribute { // Required parameter. public readonly string text; // Constructor with required parameter. public ExampleAttribute(string text) { this.text = text; } // Optional parameter. public float SomeValue { get; set; } }
Example
public class ExampleComponent : MonoBehaviour
{
// Required parameter.
[Example("Some Text")]
public float value;
// Required and optional parameter.
[Example("Some Text", Value = 10.0f)]
public float value;
}