Modify gravity in game

OK sort of new to unity and i have a quick question. are you able to modify gravity in-game like if i have one button and press it gravity = 0 another one where gravity = 9.8 etc. or can i have a way where the end user can change the gravity by entering a value in or using a gui slider

If you want universal gravity, you could use Physics.gravity, and instead of writing something like Vector3(0, -10, 0), make a variable called gravity, set it to the start number, and place that in the Vector3:
Physics.gravity = Vector3(0, -gravity, 0);
If you place that in the FixedUpdate function, you should be able to set something like: if(Input.GetButton(“up”) {gravity += 1;}
I didn’t test this, but that seems to make sense.

This all depends on if you’re using Rigid Bodies or not. RB’s are the only things that are affected by gravity- anything else you’ll have to hand-code.

If you want to change the physics system’s gravity just got to Edit->Project Settings->Physics and adjust the gravity Vector3. By default it’s (0,-9.81,0) the lower the Y value, the more intense the gravitational pull will be.