docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ContextContainer

    ContextContainer is a Dictionary like storage where the key is a generic parameter and the value is of the same type.

    Inheritance
    object
    ContextContainer
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public class ContextContainer : IDisposable

    Methods

    Contains<T>()

    Check if the value of type T has previously been created.

    Declaration
    public bool Contains<T>() where T : ContextItem, new()
    Returns
    Type Description
    bool

    Returns true if the value exists and false otherwise.

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Create<T>()

    Creates the value of type T.

    Declaration
    public T Create<T>() where T : ContextItem, new()
    Returns
    Type Description
    T

    The value of type T created inside the ContextContainer.

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Exceptions
    Type Condition
    InvalidOperationException

    Thown if you try to create the value of type T agian after it is already created.

    Dispose()

    Call Dispose to remove the created values.

    Declaration
    public void Dispose()

    GetOrCreate<T>()

    Creates the value of type T if the value is not previously created otherwise try to get the value of type T.

    Declaration
    public T GetOrCreate<T>() where T : ContextItem, new()
    Returns
    Type Description
    T

    Returns the value of type T which is created or retrived.

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Get<T>()

    Retrives a T of class ContextContainerItem if it was previously created without it being disposed.

    Declaration
    public T Get<T>() where T : ContextItem, new()
    Returns
    Type Description
    T

    The value created previously using Create<T> .

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Exceptions
    Type Condition
    InvalidOperationException

    This is thown if the value isn't previously created.

    Implements

    IDisposable

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)