Library/PackageCache/com.unity.quicksearch@1.6.0-preview.8/Editor/Indexing/ObjectIndexer.cs
/// <summary>
/// Call all the registered custom indexer for an object of a specific type. See <see cref="CustomObjectIndexerAttribute"/>.
/// </summary>
/// <param name="id">Object id.</param>
/// <param name="obj">Object to index.</param>
/// <param name="documentIndex">Document where the indexed object was found.</param>
/// <param name="so">SerializedObject representation of obj.</param>
/// <param name="multiLevel">If true, calls all the indexer that would fit the type of the object (all assignable type). If false only check for an indexer registered for the exact type of the Object.</param>
Call all the registered custom indexer for an object of a specific type. See .
Call all the registered custom indexer for an object of a specific type . See .
protected void CallCustomIndexers(string id, Object obj, int documentIndex, SerializedObject so, bool multiLevel = true)
        {
            var objectType = obj.GetType();
            List<Action<CustomObjectIndexerTarget, ObjectIndexer>> customIndexers;
            if (!multiLevel)
            {
                if (!m_CustomObjectIndexers.TryGetValue(objectType, out customIndexers))
                    return;
            }
            else
            {
                customIndexers = new List<Action<CustomObjectIndexerTarget, ObjectIndexer>>();
                var indexerTypes = m_CustomObjectIndexers.Keys;
                foreach (var indexerType in indexerTypes)
                {
                    if (indexerType.IsAssignableFrom(objectType))
                        customIndexers.AddRange(m_CustomObjectIndexers[indexerType]);
                }
            }
            var indexerTarget = new CustomObjectIndexerTarget
            {
                id = id,
                documentIndex = documentIndex,
                target = obj,
                serializedObject = so,
                targetType = objectType
            };
            foreach (var customIndexer in customIndexers)
            {
                customIndexer(indexerTarget, this);
            }
        }
protected void CallCustomIndexers ( string id , Object obj , int documentIndex , SerializedObject so , bool multiLevel = true ) { var objectType = obj . GetType ( ) ; List < Action < CustomObjectIndexerTarget , ObjectIndexer > > customIndexers ; if ( ! multiLevel ) { if ( ! m_CustomObjectIndexers . TryGetValue ( objectType , out customIndexers ) ) return ; } else { customIndexers = new List < Action < CustomObjectIndexerTarget , ObjectIndexer > > ( ) ; var indexerTypes = m_CustomObjectIndexers . Keys ; foreach ( var indexerType in indexerTypes ) { if ( indexerType . IsAssignableFrom ( objectType ) ) customIndexers . AddRange ( m_CustomObjectIndexers [ indexerType ] ) ; } } var indexerTarget = new CustomObjectIndexerTarget { id = id , documentIndex = documentIndex , target = obj , serializedObject = so , targetType = objectType } ; foreach ( var customIndexer in customIndexers ) { customIndexer ( indexerTarget , this ) ; } }
Call all the registered custom indexer for an object of a specific type.
Call all the registered custom indexer for an object of a specific type .
id
string
None
obj
Object
Object to index.
Object to index .
documentIndex
int
Document where the indexed object was found.
Document where the indexed object was found .
so
SerializedObject
SerializedObject representation of obj.
SerializedObject representation of obj .
multiLevel
bool
If true, calls all the indexer that would fit the type of the object (all assignable type). If false only check for an indexer registered for the exact type of the Object.
If true calls all the indexer that would fit the type of the object ( all assignable type ) . If false only check for an indexer registered for the exact type of the Object .