public override void Initialize()
        {
            base.Initialize();

            property     = SerializedPropertyUtility.CreateTemporaryProperty(metadata.definedType);
            propertyType = property.GetUnderlyingType();

            var adaptiveWidthAttribute = propertyType.GetAttribute <InspectorAdaptiveWidthAttribute>();

            _adaptiveWidth = adaptiveWidthAttribute?.width ?? 200;
        }
Пример #2
0
        private static TIndividual GetIndividualDrawer(SerializedProperty property)
        {
            var hash = SerializedPropertyUtility.GetPropertyHash(property);

            if (!individualDrawers.ContainsKey(hash))
            {
                var individualDrawer = new TIndividual();
                individualDrawer.Initialize(property);
                individualDrawers.Add(hash, individualDrawer);
                // Debug.LogFormat("Creating drawer for '{0}.{1}'.\n", property.serializedObject.targetObject.name, property.propertyPath);
            }

            return(individualDrawers[hash]);
        }
Пример #3
0
        public Metadata AutoDig(string path)
        {
            var metadata = this;

            foreach (var pathPart in path.Split('.'))
            {
                string fieldName;
                int    index;

                if (SerializedPropertyUtility.IsPropertyIndexer(pathPart, out fieldName, out index))
                {
                    metadata = metadata.Member(fieldName);
                    metadata = metadata.Index(index);
                }
                else
                {
                    metadata = metadata.Member(fieldName);
                }
            }

            return(metadata);
        }
 public override void Dispose()
 {
     SerializedPropertyUtility.DestroyTemporaryProperty(property);
     base.Dispose();
 }