Would be easiest if you didn’t add the rigidbody component in the first place, then it will be frozen and never fall. Even if you need one for some reason, you can uncheck “use gravity” in the inspector; you don’t need code for that.
try using Start() next time, it works for me, but if you want its to make it completely static, make it a kinematic rigid body, with isKinematic(rigidbody.isKinematic = true;) otherwise it will not use gravity, but it will still be affected by forces