- Home /
How to modify the gravity between scenes?
I modified the gravity from edit/project settings/physics/gravity.But now after I build the scenes, all of them have the same gravity.How can I have have different gravity values on different scenes?
Answer by _Daniel_ · Jun 08, 2013 at 09:01 PM
Put a script into every scene, and have that script change the gravity inside Awake(). It would go something like this:
var gravity = Vector3 (0, -9.81, 0);
function Awake () {
Physics.gravity = gravity;
}
I said it worked but didn't.How should I put a script into every scene? Do I have to refer to the scene?
Just create an empty game object (say, "GravityController") and attach the script to it, then make it a prefab so that you can create a clone in each scene. Drag the prefab to each scene, and adjust the desired gravity in the Inspector.
Your answer
Follow this Question
Related Questions
Gravity on a rotating platform 1 Answer
how to make an object fall slowly ? 2 Answers
How can i rotate player when player jump ? 2 Answers
Roof of the builiding (physics) 1 Answer
Funfair simulation help 0 Answers