Skip to content

Painter Attirbute

  1. Create new class, for example ExampleAttribute.cs

    public class ExampleAttribute
    {
    
    }
    

  2. Inherit from PainterAttribute class.

    public class ExampleAttribute : PainterAttribute
    {
    
    }
    

  3. Optionaly add Required/Optional parameters.

    public class ExampleAttribute : PainterAttribute
    {
        // 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;
}