How do I add gravity in code?

I have been trying to add my own gravity for sometime now and cannot find anything thought this would be the place. I need my own gravity because my character keep on flipping and it will fix it. thanks in advance.

You probably just want to tick “Freeze rotation” for XYZ in your rigidbody “Constraints” to stop it flipping and save the hassle of creating your own gravity just to work around an issue.