Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

PhysicsLowLevelSettings2D

class in UnityEngine.LowLevelPhysics2D

/

Inherits from:ScriptableObject

/

Implemented in:UnityEngine.Physics2DModule

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

Description

Physics LowLevel Settings Asset. This contains all the global physics options along with the default values for the following definitions:

Properties

Property Description
bypassLowLevel Controls the simulation and rendering of any PhysicsWorld. When true, no automatic simulation or rendering will occur (bypassed). When false, normal operation occurs with automatic simulation and rendering. The only case for this to be true is when the low-level physics is not being used at all so this would remove any overhead of simulation or rendering but in most cases, this should be false which is the default.
concurrentSimulations Controls how many simulations can be started in parallel. Each one is started on its own worker and acts as its own main-thread. Workers should ideally be left free for the solver otherwise it may degrade solving performance. The actual quantity of workers used will always be capped to those available on the current device. If the total number of workers available is below 4 then parallel simulation won't occur however parallel solving using workers will. This should not be confused with the quantity of workers used when solving a simulation. See PhysicsWorldDefinition.simulationWorkers.
drawInBuild Controls if the debug drawer can be used in a Player Development Build.
lengthUnitsPerMeter The internal length units per meter. The physics system bases all length units on meters but you may need different units for your project. You can set this value to use different units but it should only be modified before any other calls to the physics system occur and only modified once. Changing this value after any physics object has been created can result in severe simulation instabilities. Essentially there are some internal tolerances, such as how close two shapes need to be before they are considered to be touching or when two vertices of a hull are so close that they should be considered the same point. For example, internally a value of 5mm (0.005 meters) is used as a value tuned to work well with most situations with game-sized objects described in meters. If you decide to work in a different unit system (such as pixels) then 0.005 pixels is not a good value for this constant and would be too precise, leading to numerical problems, especially far from the origin. Instead you should determine roughly how many pixels you have per meter. For example, say you want 32 pixels per meter then you should set the lengthUnitsPerMeter to be 32.0f. Setting a value of (say) 32.05 would result in the 5mm being scaled up to 0.16 meters, which is a more reasonable value for determining if shapes are touching and hull vertices are too close. A good rule of thumb is to pass the pixel height of your player character to this function, so if your player character is 32 pixels high, then pass 32 to this function. Then you may confidently use pixels for all the length values sent to the physics system. All length values returned from the physics system will also then naturally be in pixels because the physics system does not do any scaling internally, however, you are now responsible for creating appropriate values for gravity, density, and forces.
physicsBodyDefinition Get/Set the PhysicsBodyDefinition.
physicsChainDefinition Get/Set the PhysicsChainDefinition.
physicsLayerNames A set of 64 "layer" names associated with each bit in a PhysicsMask when used for contacts and queries.
physicsShapeDefinition Get/Set the PhysicsShapeDefinition.
physicsWorldDefinition Get/Set the PhysicsWorldDefinition.
useFullLayers Controls if full 64-bit layers are used based upon PhysicsLowLevelSettings2D.physicsLayerNames or if not, the standard 32-bit layers based upon UnityEngine.LayerMask. If a PhysicsLowLevelSettings2D asset is assigned then the full layers (PhysicsLowLevelSettings2D.physicsLayerNames) will be used if PhysicsLowLevelSettings2D.useFullLayers is also active. If no PhysicsLowLevelSettings2D asset is assigned then the global layers (See UnityEngine.LayerMask) will be used.

Inherited Members

Properties

PropertyDescription
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

MethodDescription
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static Methods

MethodDescription
DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.
CreateInstanceCreates an instance of a scriptable object.

Operators

OperatorDescription
boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.

Messages

MessageDescription
AwakeCalled when an instance of ScriptableObject is created.
OnDestroyThis function is called when the scriptable object will be destroyed.
OnDisableThis function is called when the scriptable object goes out of scope.
OnEnableThis function is called when the object is loaded.
OnValidateEditor-only function that Unity calls when the script is loaded or a value changes in the Inspector.
ResetReset to default values.