public void HandleDrawnType(Type drawnType, Type propertyType, FieldInfo field, PropertyAttribute attribute)
        {
            Type drawerTypeForType = ScriptAttributeUtility.GetDrawerTypeForType(drawnType);

            if (drawerTypeForType != null)
            {
                if (typeof(PropertyDrawer).IsAssignableFrom(drawerTypeForType))
                {
                    if (propertyType != null && propertyType.IsArrayOrList())
                    {
                        return;
                    }
                    this.m_PropertyDrawer             = (PropertyDrawer)Activator.CreateInstance(drawerTypeForType);
                    this.m_PropertyDrawer.m_FieldInfo = field;
                    this.m_PropertyDrawer.m_Attribute = attribute;
                }
                else if (typeof(DecoratorDrawer).IsAssignableFrom(drawerTypeForType))
                {
                    if (field != null && field.FieldType.IsArrayOrList() && !propertyType.IsArrayOrList())
                    {
                        return;
                    }
                    DecoratorDrawer decoratorDrawer = (DecoratorDrawer)Activator.CreateInstance(drawerTypeForType);
                    decoratorDrawer.m_Attribute = attribute;
                    if (this.m_DecoratorDrawers == null)
                    {
                        this.m_DecoratorDrawers = new List <DecoratorDrawer>();
                    }
                    this.m_DecoratorDrawers.Add(decoratorDrawer);
                }
            }
        }
        public void HandleDrawnType(Type drawnType, Type propertyType, FieldInfo field, PropertyAttribute attribute)
        {
            Type drawerType = ScriptAttributeUtility.GetDrawerTypeForType(drawnType);

            // If we found a drawer type, instantiate the drawer, cache it, and return it.
            if (drawerType != null)
            {
                if (typeof(PropertyDrawer).IsAssignableFrom(drawerType))
                {
                    // Use PropertyDrawer on array elements, not on array itself.
                    // If there's a PropertyAttribute on an array, we want to apply it to the individual array elements instead.
                    // This is the only convenient way we can let the user apply PropertyDrawer attributes to elements inside an array.
                    if (propertyType != null && propertyType.IsArrayOrList())
                    {
                        return;
                    }

                    m_PropertyDrawer             = (PropertyDrawer)System.Activator.CreateInstance(drawerType);
                    m_PropertyDrawer.m_FieldInfo = field;

                    // Will be null by design if default type drawer!
                    m_PropertyDrawer.m_Attribute = attribute;
                }
                else if (typeof(DecoratorDrawer).IsAssignableFrom(drawerType))
                {
                    // Draw decorators on array itself, not on each array elements
                    if (field != null && field.FieldType.IsArrayOrList() && !propertyType.IsArrayOrList())
                    {
                        return;
                    }

                    DecoratorDrawer decorator = (DecoratorDrawer)System.Activator.CreateInstance(drawerType);
                    decorator.m_Attribute = attribute;

                    if (m_DecoratorDrawers == null)
                    {
                        m_DecoratorDrawers = new List <DecoratorDrawer>();
                    }
                    m_DecoratorDrawers.Add(decorator);
                }
            }
        }