Rigidbody2D.gravityScale

Does not work .gravityScale in Unity 5, cant “fall down” my Rigidbody2D component. Power always push my object on top, i write:

hit.GetComponent<Rigidbody2D>().gravityScale = 0.7f;

OR

hit.GetComponent<Rigidbody2D>().gravityScale = -0.7f;

But result same…
How can I let the objects “fall down”?

Hi, I have fixed this problem. I simply unchecked “Apply Root Motion” under the animator. I guess the conversion to Unity 5 somehow reset that value. Let me know if this solved the issue, it sure did for me.

Try
Physics2D.gravity = new vector2(0,-1);

I found THREE solutions:

1) Animator → unchecked “Apply Root Motion”.

2) Reload components Rigidbody2D in the Object. (Delete Rigidbody2D and add this component again)

3) Asset → Run API Updater, and re-compile wrong script again (Only upgrage project Unity4 → Unity5)


Thanks all people who help me!

try
public Rigidbody2D rb;

void start
{
rb.gravityScale = 0.7f;
}