UdonToolkit icon indicating copy to clipboard operation
UdonToolkit copied to clipboard

Popup attribute does not work for int-like variables, such as bytes

Open Phasedragon opened this issue 2 years ago • 2 comments

that is all

Phasedragon avatar Nov 14 '21 19:11 Phasedragon

I need to look up a way to determine if the variable is int-like i guess

orels1 avatar Nov 25 '21 11:11 orels1

So apparently this is the correct way of doing it

    private static HashSet<Type> NumericTypes = new HashSet<Type>
    {
        typeof(int),
        typeof(uint),
        typeof(double),
        typeof(decimal),
        ...
    };

    internal static bool IsNumericType(Type type)
    {
        return NumericTypes.Contains(type) ||
               NumericTypes.Contains(Nullable.GetUnderlyingType(type));
    }

sigh

Just literally have a hash set of compatible types :/

orels1 avatar Nov 27 '21 10:11 orels1