Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

DynamicBuffer<T0>.Capacity

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public int Capacity;

Description

The number of elements the buffer can hold.

Capacity can not be set lower than DynamicBuffer<T0>.Length - this will raise an exception. If Capacity grows greater than the internal capacity of the DynamicBuffer, memory external to the DynamicBuffer will be allocated. If Capacity shrinks to the internal capacity of the DynamicBuffer or smaller, memory external to the DynamicBuffer will be freed. No effort is made to avoid costly reallocations when Capacity changes slightly; if Capacity is incremented by 1, an array 1 element bigger is allocated.