Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


gravityScale

The degree to which this object is affected by gravity.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public float gravityScale { get; set; }

Remarks

In 2D physics, the gravity is a global setting in the Physics2D class but you can also control the proportion of that gravity applied to each object individually using gravityScale. For example, it may be easier to implement a flying character by turning off its gravity rather than simulating the forces that keep it aloft.
Additional Resources: _gravity