/// <summary>
        /// Gets the serialized parameters of the component.
        /// </summary>
        /// <param name="inChildren">Get the child properties of a property.</param>
        public void GetParameters(bool inChildren = true)
        {
            var type = target.GetType();

            while (type != null)
            {
                var fields = type
                             .GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                             .Where(t => t.Name != "enabled")
                             .Where(t =>
                                    (t.IsPublic && t.GetCustomAttributes(typeof(NonSerializedAttribute), false).Length == 0) ||
                                    (t.GetCustomAttributes(typeof(SerializeField), false).Length > 0)
                                    )
                             .ToList();

                foreach (var field in fields)
                {
                    var property = serializedObject.FindProperty(field.Name);
                    // Serialized fields with unsupported types will not have SerializedProperties
                    if (property == null)
                    {
                        continue;
                    }

                    var attributes = field.GetCustomAttributes(false).Cast <Attribute>().ToArray();
                    var parameter  = new SerializedPropertyData(property, field.FieldType, attributes);
                    m_Parameters.Add(parameter);
                }

                type = inChildren ? type.BaseType : null;
            }
        }
        public override void OnEnable()
        {
            base.OnEnable();
            m_PlaneSizeCondition = (PlaneSizeCondition)target;

            m_MinSizeProperty    = serializedObject.FindSerializedPropertyData("m_MinimumSize");
            m_MaxSizeProperty    = serializedObject.FindSerializedPropertyData("m_MaximumSize");
            m_MinBoundedProperty = serializedObject.FindSerializedPropertyData("m_MinBounded");
            m_MaxBoundedProperty = serializedObject.FindSerializedPropertyData("m_MaxBounded");

            m_PlaneSizeCondition.AdjustingChanged += OnAdjustingChanged;
            CleanUp();
        }
Exemplo n.º 3
0
 public override void OnEnable()
 {
     base.OnEnable();
     m_TraitNameProperty = serializedObject.FindSerializedPropertyData("m_TraitName");
     m_MatchRuleProperty = serializedObject.FindSerializedPropertyData("m_MatchRule");
 }
Exemplo n.º 4
0
 SerializedPropertyData(SerializedPropertyData propertyData)
 {
     Value      = propertyData.Value.Copy();
     Attributes = propertyData.Attributes.ToArray();
     Type       = propertyData.Type;
 }