docs.unity3d.com
    目次を表示する/隠す

    Struct NativeParallelHashMap<TKey, TValue>.ParallelWriter

    A parallel writer for a NativeParallelHashMap.

    Namespace: Unity.Collections
    Syntax
    [NativeContainer]
    [NativeContainerIsAtomicWriteOnly]
    public struct ParallelWriter
    Remarks

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

    Properties

    Capacity

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

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

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

    m_ThreadIndex

    Returns the index of the current thread.

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

    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

    TryAdd(TKey, TValue)

    Adds a new key-value pair.

    Declaration
    public bool TryAdd(TKey key, TValue item)
    Parameters
    Type Name Description
    TKey key

    The key to add.

    TValue item

    The value to add.

    Returns
    Type Description
    Boolean

    True if the key-value pair was added.

    Remarks

    If the key is already present, this method returns false without modifying this hash map.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)