Class HierarchicalComponentContainer<TContainer, TComponent> | Platforms | 0.2.2-preview.10
docs.unity.cn
    Show / Hide Table of Contents

    Class HierarchicalComponentContainer<TContainer, TComponent>

    Base class that stores a set of hierarchical components by type. Other containers can be added as dependencies to get inherited or overridden components.

    Inheritance
    Object
    ScriptableObjectPropertyContainer<TContainer>
    HierarchicalComponentContainer<TContainer, TComponent>
    BuildConfiguration
    BuildSettings
    Inherited Members
    ScriptableObjectPropertyContainer<TContainer>.CreateInstance(Action<TContainer>)
    ScriptableObjectPropertyContainer<TContainer>.CreateAsset(String, Action<TContainer>)
    ScriptableObjectPropertyContainer<TContainer>.CreateAssetInActiveDirectory(String, Action<TContainer>)
    ScriptableObjectPropertyContainer<TContainer>.LoadAsset(String)
    ScriptableObjectPropertyContainer<TContainer>.LoadAsset(GUID)
    ScriptableObjectPropertyContainer<TContainer>.SaveAsset(String)
    ScriptableObjectPropertyContainer<TContainer>.RestoreAsset()
    ScriptableObjectPropertyContainer<TContainer>.IsModified()
    ScriptableObjectPropertyContainer<TContainer>.SerializeToJson()
    ScriptableObjectPropertyContainer<TContainer>.DeserializeFromJson(TContainer, String)
    ScriptableObjectPropertyContainer<TContainer>.SerializeToPath(String)
    ScriptableObjectPropertyContainer<TContainer>.DeserializeFromPath(TContainer, String)
    ScriptableObjectPropertyContainer<TContainer>.OnBeforeSerialize()
    ScriptableObjectPropertyContainer<TContainer>.OnAfterDeserialize()
    Namespace: Unity.Build
    Syntax
    public abstract class HierarchicalComponentContainer<TContainer, TComponent> : ScriptableObjectPropertyContainer<TContainer>, ISerializationCallbackReceiver where TContainer : HierarchicalComponentContainer<TContainer, TComponent>
    Type Parameters
    Name Description
    TContainer

    Type of the component container.

    TComponent

    Components base type.

    Methods

    AddDependency(TContainer)

    Add a dependency to this container. Circular dependencies or dependencies on self are not allowed.

    Declaration
    public bool AddDependency(TContainer dependency)
    Parameters
    Type Name Description
    TContainer dependency

    The dependency to add.

    Returns
    Type Description
    Boolean

    true if the dependency was added, false otherwise.

    ClearComponents()

    Remove all components from this container.

    Declaration
    public void ClearComponents()

    ClearDependencies()

    Remove all dependencies from this container.

    Declaration
    public void ClearDependencies()

    CreateInstance(TContainer)

    Create a new instance that duplicates the specified container.

    Declaration
    public static TContainer CreateInstance(TContainer container)
    Parameters
    Type Name Description
    TContainer container
    Returns
    Type Description
    TContainer

    The new asset instance.

    GetComponent(Type)

    Get the value of a Type component.

    Declaration
    public TComponent GetComponent(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    Returns
    Type Description
    TComponent

    GetComponent<T>()

    Get the value of a T component.

    Declaration
    public T GetComponent<T>()
        where T : TComponent
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    Type of the component.

    GetComponentOrDefault(Type)

    Get the value of a Type component if found. Otherwise an instance created using utility. The container is not modified.

    Declaration
    public TComponent GetComponentOrDefault(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    Returns
    Type Description
    TComponent

    The component value.

    GetComponentOrDefault<T>()

    Get the value of a T component if found. Otherwise an instance created using utility. The container is not modified.

    Declaration
    public T GetComponentOrDefault<T>()
        where T : TComponent
    Returns
    Type Description
    T

    The component value.

    Type Parameters
    Name Description
    T

    Type of the component.

    GetComponents()

    Get a flatten list of all components recursively from this container and its dependencies.

    Declaration
    public IEnumerable<TComponent> GetComponents()
    Returns
    Type Description
    IEnumerable<TComponent>

    List of components.

    GetComponents(Type)

    Get a flatten list of all components recursively from this container and its dependencies, that matches Type.

    Declaration
    public IEnumerable<TComponent> GetComponents(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<TComponent>

    List of components.

    GetComponents<T>()

    Get a flatten list of all components recursively from this container and its dependencies, that matches T.

    Declaration
    public IEnumerable<T> GetComponents<T>()
        where T : TComponent
    Returns
    Type Description
    IEnumerable<T>

    List of components.

    Type Parameters
    Name Description
    T

    Type of the components.

    GetComponentTypes()

    Get a flatten list of all component types from this container and its dependencies.

    Declaration
    public IEnumerable<Type> GetComponentTypes()
    Returns
    Type Description
    IEnumerable<Type>

    List of component types.

    GetDependencies()

    Get a flatten list of all dependencies recursively from this container and its dependencies.

    Declaration
    public IEnumerable<TContainer> GetDependencies()
    Returns
    Type Description
    IEnumerable<TContainer>

    List of dependencies.

    HasComponent(Type)

    Determine if a Type component is stored in this container or its dependencies.

    Declaration
    public bool HasComponent(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    Returns
    Type Description
    Boolean

    HasComponent<T>()

    Determine if a T component is stored in this container or its dependencies.

    Declaration
    public bool HasComponent<T>()
        where T : TComponent
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    Type of the component.

    HasDependency(TContainer)

    Determine if a dependency exist in this container or its dependencies.

    Declaration
    public bool HasDependency(TContainer dependency)
    Parameters
    Type Name Description
    TContainer dependency

    The dependency to search.

    Returns
    Type Description
    Boolean

    true if the dependency is found, false otherwise.

    IsComponentInherited(Type)

    Determine if a Type component is inherited from a dependency.

    Declaration
    public bool IsComponentInherited(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    Returns
    Type Description
    Boolean

    IsComponentInherited<T>()

    Determine if a T component is inherited from a dependency.

    Declaration
    public bool IsComponentInherited<T>()
        where T : TComponent
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    Type of the component.

    IsComponentOverridden(Type)

    Determine if a Type component overrides a dependency.

    Declaration
    public bool IsComponentOverridden(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    Returns
    Type Description
    Boolean

    IsComponentOverridden<T>()

    Determine if a T component overrides a dependency.

    Declaration
    public bool IsComponentOverridden<T>()
        where T : TComponent
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    Type of the component.

    RemoveComponent(Type)

    Remove a Type component from this container.

    Declaration
    public bool RemoveComponent(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    Returns
    Type Description
    Boolean

    RemoveComponent<T>()

    Remove all T components from this container.

    Declaration
    public bool RemoveComponent<T>()
        where T : TComponent
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    Type of the component.

    RemoveDependency(TContainer)

    Remove a dependency from this container.

    Declaration
    public bool RemoveDependency(TContainer dependency)
    Parameters
    Type Name Description
    TContainer dependency

    The dependency to remove.

    Returns
    Type Description
    Boolean

    Reset()

    Declaration
    protected override void Reset()
    Overrides
    Unity.Build.ScriptableObjectPropertyContainer<TContainer>.Reset()

    Sanitize()

    Declaration
    protected override void Sanitize()
    Overrides
    Unity.Build.ScriptableObjectPropertyContainer<TContainer>.Sanitize()

    SetComponent(Type)

    Set the value of a Type component on this container using an instance created using utility.

    Declaration
    public void SetComponent(Type type)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    SetComponent(Type, TComponent)

    Set the value of a Type component on this container.

    Declaration
    public void SetComponent(Type type, TComponent value)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    TComponent value

    Value of the component to set.

    SetComponent<T>()

    Set the value of a T component on this container using an instance created using utility.

    Declaration
    public void SetComponent<T>()
        where T : TComponent
    Type Parameters
    Name Description
    T

    Type of the component.

    SetComponent<T>(T)

    Set the value of a T component on this container.

    Declaration
    public void SetComponent<T>(T value)
        where T : TComponent
    Parameters
    Type Name Description
    T value

    Value of the component to set.

    Type Parameters
    Name Description
    T

    Type of the component.

    TryGetComponent(Type, out TComponent)

    Try to get the value of a Type component.

    Declaration
    public bool TryGetComponent(Type type, out TComponent value)
    Parameters
    Type Name Description
    Type type

    Type of the component.

    TComponent value

    Out value of the component.

    Returns
    Type Description
    Boolean

    TryGetComponent<T>(out T)

    Try to get the value of a T component.

    Declaration
    public bool TryGetComponent<T>(out T value)
        where T : TComponent
    Parameters
    Type Name Description
    T value

    Out value of the component.

    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    Type of the component.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX