docs.unity3d.com
    Show / Hide Table of Contents

    Class CachedComponentFilter<TFilterType, TRootType>

    Class that allows for cached retrieval/filtering of multiple types of components into lists Proper usage of this class is:

    using (var componentFilter = new CachedComponentFilter<typeToFind,componentTypeThatContains>(instanceOfComponent))
    {
    
    }
    Inheritance
    Object
    CachedComponentFilter<TFilterType, TRootType>
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.XR.CoreUtils
    Syntax
    public class CachedComponentFilter<TFilterType, TRootType> : IDisposable where TFilterType : class where TRootType : Component
    Type Parameters
    Name Description
    TFilterType

    The type of component to find

    TRootType

    The type of component at the root of the hierarchy

    Constructors

    CachedComponentFilter(TFilterType[], Boolean)

    Initialize a new cached component filter

    Declaration
    public CachedComponentFilter(TFilterType[] componentList, bool includeDisabled = true)
    Parameters
    Type Name Description
    TFilterType[] componentList

    The array of objects to use

    Boolean includeDisabled

    Whether to include components on disabled objects

    CachedComponentFilter(TRootType, CachedSearchType, Boolean)

    Initialize a new cached component filter

    Declaration
    public CachedComponentFilter(TRootType componentRoot, CachedSearchType cachedSearchType = CachedSearchType.Children | CachedSearchType.Self, bool includeDisabled = true)
    Parameters
    Type Name Description
    TRootType componentRoot

    The component at the root of the hierarchy

    CachedSearchType cachedSearchType

    What type of hierarchy traversal to perform

    Boolean includeDisabled

    Whether to include components on disabled objects

    Methods

    Dispose()

    Part of the IDisposable pattern

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    Dispose(Boolean)

    Dispose of the cached component filter

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing

    Whether or not to dispose the contents of this object

    GetMatchingComponents<TChildType>()

    Get an array of matching components

    Declaration
    public TChildType[] GetMatchingComponents<TChildType>()
        where TChildType : class, TFilterType
    Returns
    Type Description
    TChildType[]

    The array of matching components

    Type Parameters
    Name Description
    TChildType

    The type for which to search. Must inherit from or be TFilterType

    StoreMatchingComponents<TChildType>(List<TChildType>)

    Store components which match TChildType

    Declaration
    public void StoreMatchingComponents<TChildType>(List<TChildType> outputList)
        where TChildType : class, TFilterType
    Parameters
    Type Name Description
    List<TChildType> outputList

    The list to which matching components will be added

    Type Parameters
    Name Description
    TChildType

    The type for which to search. Must inherit from or be TFilterType

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023