Beispiel #1
0
        private void Initialize(SerializedProperty property)
        {
            if (!_conditionalToTarget.ContainsKey(property))
            {
                _conditionalToTarget.Add(property, ConditionalFieldUtility.FindRelativeProperty(property, Conditional.FieldToCheck));
            }

            if (_customDrawersCached)
            {
                return;
            }
            if (_allPropertyDrawerAttributeTypes == null)
            {
                _allPropertyDrawerAttributeTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())
                                                   .Where(x => typeof(PropertyDrawer).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract);
            }

            if (HaveMultipleAttributes())
            {
                _multipleAttributes = true;
                GetPropertyDrawerType(property);
            }
            else if (fieldInfo != null && !fieldInfo.FieldType.Module.ScopeName.Equals(typeof(int).Module.ScopeName))
            {
                _specialType = true;
                GetTypeDrawerType(property);
            }

            _customDrawersCached = true;
        }
Beispiel #2
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            Initialize(property);

            _toShow = ConditionalFieldUtility.PropertyIsVisible(_conditionalToTarget[property], Conditional.Inverse, Conditional.CompareValues);
            if (!_toShow)
            {
                return(0);
            }

            if (_genericAttributeDrawerInstance != null)
            {
                return(_genericAttributeDrawerInstance.GetPropertyHeight(property, label));
            }

            if (_genericTypeDrawerInstance != null)
            {
                return(_genericTypeDrawerInstance.GetPropertyHeight(property, label));
            }

            return(EditorGUI.GetPropertyHeight(property));
        }