docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NativeParallelMultiHashMap<TKey, TValue>.ParallelWriter

    A parallel writer for a NativeParallelMultiHashMap.

    Namespace: Unity.Collections
    Assembly: Unity.Collections.dll
    Syntax
    [NativeContainer]
    [NativeContainerIsAtomicWriteOnly]
    public struct NativeParallelMultiHashMap<TKey, TValue>.ParallelWriter
    Remarks

    Use AsParallelWriter() to create a parallel writer for a NativeParallelMultiHashMap.

    Properties

    Capacity

    Returns the number of key-value pairs that fit in the current allocation.

    Declaration
    public readonly int Capacity { get; }
    Property Value
    Type Description
    int

    The number of key-value pairs that fit in the current allocation.

    m_ThreadIndex

    Returns the index of the current thread.

    Declaration
    public int m_ThreadIndex { get; }
    Property Value
    Type Description
    int

    The index of the current thread.

    Remarks

    In a job, each thread gets its own copy of the ParallelWriter struct, and the job system assigns each copy the index of its thread.

    Methods

    Add(TKey, TValue)

    Adds a new key-value pair.

    Declaration
    public void Add(TKey key, TValue item)
    Parameters
    Type Name Description
    TKey key

    The key to add.

    TValue item

    The value to add.

    Remarks

    If a key-value pair with this key is already present, an additional separate key-value pair is added.

    Add(TKey, TValue, int)

    Adds a new key-value pair.

    Declaration
    public void Add(TKey key, TValue item, int threadIndexOverride)
    Parameters
    Type Name Description
    TKey key

    The key to add.

    TValue item

    The value to add.

    int threadIndexOverride

    The thread index which must be set by a field from a job struct with the NativeSetThreadIndexAttribute attribute.

    Remarks

    If a key-value pair with this key is already present, an additional separate key-value pair is added.

    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)