docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetOrCreate

    GetOrCreate<TContext>(uint)

    Creates a shared static data for the specified context (usable from both C# and HPC#)

    Declaration
    public static SharedStatic<T> GetOrCreate<TContext>(uint alignment = 0)
    Parameters
    Type Name Description
    uint alignment

    Optional alignment

    Returns
    Type Description
    SharedStatic<T>

    A shared static for the specified context

    Type Parameters
    Name Description
    TContext

    A type class that uniquely identifies the this shared data.

    GetOrCreate<TContext, TSubContext>(uint)

    Creates a shared static data for the specified context and sub-context (usable from both C# and HPC#)

    Declaration
    public static SharedStatic<T> GetOrCreate<TContext, TSubContext>(uint alignment = 0)
    Parameters
    Type Name Description
    uint alignment

    Optional alignment

    Returns
    Type Description
    SharedStatic<T>

    A shared static for the specified context

    Type Parameters
    Name Description
    TContext

    A type class that uniquely identifies the this shared data.

    TSubContext

    A type class that uniquely identifies this shared data within a sub-context of the primary context

    GetOrCreate(Type, uint)

    Creates a shared static data for the specified context (reflection based, only usable from C#, but not from HPC#)

    Declaration
    public static SharedStatic<T> GetOrCreate(Type contextType, uint alignment = 0)
    Parameters
    Type Name Description
    Type contextType

    A type class that uniquely identifies the this shared data

    uint alignment

    Optional alignment

    Returns
    Type Description
    SharedStatic<T>

    A shared static for the specified context

    GetOrCreate(Type, Type, uint)

    Creates a shared static data for the specified context and sub-context (usable from both C# and HPC#)

    Declaration
    public static SharedStatic<T> GetOrCreate(Type contextType, Type subContextType, uint alignment = 0)
    Parameters
    Type Name Description
    Type contextType

    A type class that uniquely identifies the this shared data

    Type subContextType

    A type class that uniquely identifies this shared data within a sub-context of the primary context

    uint alignment

    Optional alignment

    Returns
    Type Description
    SharedStatic<T>

    A shared static for the specified context

    In This Article
    Back to top
    Copyright © 2025 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)