It seems that CreatePropertyGUI() is not getting called for properties that are arrays. I’m using a custom editor window and it works fine for normal properties.
Attribute…
[AttributeUsage(AttributeTargets.Field)]
public class AssetDropdownAttribute : PropertyAttribute
{
public Type SourceType { get; private set; }
public AssetDropdownAttribute(Type sourceType) { SourceType = sourceType; }
}
Drawer…
[CustomPropertyDrawer(typeof(AssetDropdownAttribute))]
public class AssetDropdownDrawer : PropertyDrawer
{
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
Debug.Log($"Property <color=cyan>{property.displayName}</color> is array: {property.isArray}");
if (property.isArray) Debug.Log($"Property Array Size: {property.arraySize}");
[...]
Class…
public class AvatarData : DataEntity
{
[Header("Misc")]
[AssetDropdown(typeof(StatPreset))]
public StatPreset StatsPreset;
[AssetDropdown(typeof(BaseAbility))]
public BaseAbility[] Abilities;
[AssetDropdown(typeof(AvatarAxisConfig))]
public AvatarAxisConfig MountAxisConfig;
[...]
Results…
Property Stats Preset is array: False
// should be seeing the array debug as True here.
Property Mount Axis Config is array: False
The public BaseAbility[ ] Abilities draws as a normal default array. Am I doing something wrong?
edit - Unity 2019.3.0b11