Version: Unity 6.6 Beta (6000.6)
LanguageEnglish
  • C#

PhysicsCoreSettings2D.initialWorldCapacity

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

Description

Get/Set the number of worlds allocated up-front when the physics system starts. Worlds are allocated as a single contiguous block, so a larger capacity uses more memory immediately and care must be taken. When all worlds are in use, more are allocated on demand up to the supported maximum, so this is an initial capacity and not a hard limit. Growing the array reallocates it, so set this to the number of worlds you expect in order to avoid reallocations during gameplay. Setting this value to one reduces start-up memory usage to a minimum while still allowing more worlds to be created later. The value must be in the range of 1 to 1024. Any change will only be handled by Exiting Play mode in the Editor or restarting the player build.

A single PhysicsWorld.defaultWorld is automatically created therefore occupies one of the allocated worlds. See PhysicsWorld.allocatedWorldCapacity for the number currently allocated, which can grow at runtime.