Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

VisualElementComponentAttribute.initialCapacity

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 initialCapacity;

Description

The number of storage slots Unity reserves up front for this component type. Set it to roughly how many elements you expect to carry this component at the same time.

You can leave this at its default value for most components; the storage grows on demand. Reserving a larger capacity avoids resizes when you know a component is used by many elements at once, for example one per row in a large list, at the cost of reserved memory if the estimate is too high. This setting only applies to components whose fields are all unmanaged value types; components with managed fields, such as strings or object references, are stored individually and ignore it.