Modifying Overall Gravity Value in Script.
May 16, 2025
Object: Modifying Overall Gravity Value in Script.
In the first step, I will create a float variable for the gravity value in my script.
To change the gravity value, we need to access physics, we do this using Physics.gravity.
If we look into this property, we can set and get its value. This property takes Vector3, I will modify the y value to -1.
Add this script to your object
If we play the Editor, our box will fall very slowly.
But not only this box, every object that has a rigid body will fall slowly.
See you in the next one.