How can I find the SerializedPropertyType of an array property?

Suppose I have a class like this:

public class Foo: ScriptableObject{
    public int[] IntArray;
    public string[] StringArray;
}

And I have some sort of custom inspector (or any other editor code) that wants to do something with int arrays, but not string arrays. Something like this:

void DoStuff(SerializedProperty p){
    if(p.isArray && p.propertyType==SerializedPropertyType.Integer){
        ...   
    }
}

Prior to Unity 2019 this code worked. However, in 2019 all array properties have propertyType==SerializedPropertyType.Generic. If the array is not empty, I could try to get the type of the array element, but for empty arrays, even this does not work.

2 Likes

Do you find the solution?