How to reset the Gravity of an object from script

Hello All,
i have a sprite sheet and i have split it by using sprite editor.
And now i have dragged the a single frame of sprite sheet into the scene.And i attached
a Rigidbody2d physics component(P.S i am in 2d view)now my gravity is enabled and i have also added a java script file to this frame .What i want is when i click on screen the gravity of object should reset to zero.
So how this could be done.

Maybe something like this will work:

referenceToYourObject.rigidbody2D.gravityScale=0f;

Wherever you handle the click on the screen event you can reference to the rigidbody of your object and set its property gravityScale to zero (I think this is the alternative to the Rigidbody.useGravity when working in 2D). I haven’t tested it but according to the documentation it should work :slight_smile: