Best way to disable gravity in rigidbody2d

I want to disable gravity in rigidbody2d for my character because I want my charcater can fly when got a special item

I change gravityscale=0 in rigidbody2d component then It work for disable my character fall down But when I use addForce for my character move horizontal it run straight away with no stop position.

Is there any solution for disable gravity can use addforce function and velocity for moving horizontal ?


You might want to consider using kinematic. Documentation here. It is usually a good replacement for rigidbody in situations like this.