Esempio n. 1
0
        /// <summary>
        /// Draw a table just from the collection's property.
        /// This will create columns for all the visible members in the elements' class,
        /// similar to what Unity would show in the classic vertical collection display, but as a table instead.
        /// </summary>
        /// <returns>The updated table state.</returns>
        /// <param name="tableState">The Table state.</param>
        /// <param name="collectionProperty">The serialized property of the collection.</param>
        /// <param name="options">The table options.</param>
        public static GUITableState DrawTable(
            GUITableState tableState,
            SerializedProperty collectionProperty,
            params GUITableOption[] options)
        {
            List <string> properties = SerializationHelpers.GetElementsSerializedFields(collectionProperty);

            if (properties == null && collectionProperty.arraySize == 0)
            {
                DrawTable(
                    null,
                    new List <TableColumn> ()
                {
                    new TableColumn(TableColumn.Title(collectionProperty.displayName + "(properties unknown, add at least 1 element)"), TableColumn.Sortable(false), TableColumn.Resizeable(false))
                },
                    new List <List <TableCell> > (),
                    collectionProperty,
                    options);
                return(tableState);
            }
            return(DrawTable(tableState, collectionProperty, properties, options));
        }