Create custom property

You can make your custom properties.

Here’s most simple code which is already contained in uss.

public class UssTextModifier
{
    [UssModifierKey("font-size")]
    public void ApplyFontSize(Text g, UssValue value)
    {
        g.fontSize = value.AsInt();
    }
}

You don’t need to inspect value’s type or casting at all.
Just use AsInt(), this already contains type-checking logic.

UssValue

UssValue v;

string s = v.AsString();
int i = v.AsInt();
float f = v.AsFloat();
Color c = v.AsColor(); 
if (v.IsNone())
    ; // none

Register

UssStyleModifier.LoadModifier<UssTextModifier>();