기술 자료

Unity Engine

Unity Engine

TryAdd

Adds a new value. If the item is already present, this method returns false without replacing said item.
읽는 시간 1분최근 업데이트: 한 달 전

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

TryAdd(T)

Adds a new value. If the item is already present, this method returns false without replacing said item.
public bool TryAdd(T item)

Parameters

item

T
The value to add.

Returns

Type

Description

boolTrue if the value is not already present.

TryAdd(T, int)

Adds a new value. If the item is already present, this method returns false without replacing said item.
public bool TryAdd(T item, int threadIndexOverride)

Parameters

item

T
The value to add.

threadIndexOverride

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

Returns

Type

Description

boolTrue if the value is not already present.