Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

PhysicsCoreSettings2D

class in Unity.U2D.Physics

/

Inherits from:ScriptableObject

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

Properties

Property Description
alwaysDrawWorlds Controls if worlds are always drawn independent of whether rendering is currently active or not as specified by PhysicsWorld.renderingMode. When true, world drawing is always active and a PhysicsEvents.WorldDrawResults event is produced containing the DrawResults. When false, world drawing only occurs depending on the PhysicsWorld.renderingMode setting. CAUTION: Drawing the world has a performance cost associated with it therefore when using this without rendering, that cost can become hidden.
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.
contactFilterMode The mode used for the ContactFilter when determining if two PhysicsShape can contact. See ContactFilterMode.
disableSimulation Controls the simulation of any PhysicsWorld temporarily removing simulation overhead. When true, no automatic simulation will occur. When false, normal operation occurs with automatic simulation.
lengthUnitsPerMeter The internal length units per meter. The physics system relates 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.
maximumWorlds Get/Set the maximum number of worlds that can be created. The larger the number of worlds, the more memory that is initially allocated so care must be taken. Setting this value to one will reduce start-up memory usage to a minimum but will not allow any additional worlds to be created. The maximum 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 available worlds.
physicsBodyDefinition Get/Set the PhysicsBodyDefinition.
physicsChainDefinition Get/Set the PhysicsChainDefinition.
physicsDistanceJointDefinition Get/Set the PhysicsDistanceJointDefinition.
physicsFixedJointDefinition Get/Set the PhysicsFixedJointDefinition.
physicsHingeJointDefinition Get/Set the PhysicsHingeJointDefinition.
physicsLayerNames A set of 64 "layer" names associated with each bit in a PhysicsMask when used for contacts and queries.
physicsRelativeJointDefinition Get/Set the PhysicsRelativeJointDefinition.
physicsShapeDefinition Get/Set the PhysicsShapeDefinition.
physicsSliderJointDefinition Get/Set the PhysicsSliderJointDefinition.
physicsWheelJointDefinition Get/Set the PhysicsWheelJointDefinition.
physicsWorldDefinition Get/Set the PhysicsWorldDefinition.
renderingMode Controls drawing and rendering is allowed. NOTE: Drawing and rendering are always available in the Unity Editor however rendering requires compute buffer support on any device it is used without which no rendering will occur. See RenderingMode.
transformChangeMode Defines when changes to Transform that has are registered with PhysicsWorld.RegisterTransformChange are called. NOTE: In the Unity Editor when not in Play Mode, Transform change callbacks are always and only sent at the start of the frame for authoring purposes. See TransformChangeMode.
usePhysicsLayers Controls if the physics 64-bit layers are used based upon PhysicsCoreSettings2D.physicsLayerNames or if not, the standard 32-bit layers based upon LayerMask. If a PhysicsCoreSettings2D asset is assigned then the physics layers (PhysicsCoreSettings2D.physicsLayerNames) will be used if PhysicsCoreSettings2D.usePhysicsLayers is also active. If no PhysicsCoreSettings2D asset is assigned then the global layers (See 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
GetEntityIdGets the EntityId of the object.
ToStringReturns the name of the object.

Static Methods

MethodDescription
DestroyRemoves a GameObject, component, or asset.
DestroyImmediateDestroys the specified object immediately. Use with caution and in Edit mode only.
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.