How to change rigidbody2d body type? Or change whether its affected by gravity or not?

I hate asking people directly but after trying to google it for over an hour and finding nothing I have to come here. I was watching a very basic tutorial that was for a previous version. In it platforms would fall after a certain time period, but everything is different now. For me I can see that only dynamic type causes gravity and others don’t, but I can’t prevent the gravity from dynamic types unless I constrict it completely. However I want it to act completely as a static rigidbody, only gaining gravity after a while, so i would think it would be very inefficient for it to be dynamic under these conditions, not to mention thats a lot of variables to change. I don’t want to program my own gravity, I want to use the one handled by unity.

How do I go about changing the body type of rigidbody2d inside a c# script? Or the next best thing if it’s not possible?

The other guy was no help at all, documentation gives little to no help in how to do it in C#. I found that you need to do something along the lines of:

gameObject.transform.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;

At which point you can either change static to Dynamic, Kinematic, or Static

@MelvMay @YamiZee

Try looking at the documentation perhaps?

Rigidbody2D.bodyType (Set to any of the RigidbodyType2D)
Rigidbody2D.gravityScale (Gravity Scale = 0 is no gravity for this body)