How to enable rigidbody constraints only at start?

I want to freeze movement at x axis on start for several seconds, then allow movement.
So i used Coroutine method to enable and disable rigidbody constraints. It is frozen on start, but not for seconds, during all the game x- axis movement is frozen.
Here is the code:

void Start() {
		StartCoroutine (Wait ());
void FixedUpdate () {
		StopCoroutine (Wait ());
IEnumerator Wait() {
		rb.constraints =RigidbodyConstraints.FreezePositionX;
		yield return new WaitForSeconds (3);


If you want to constrain the movement from the beginning, you could just check the checkbox on the rigidbody. Anyway, you are setting the constraints from the scripts, no problem there. You are not “unchecking it”. You need some code to say: he, rb.constraints = “no constraints”. Stopping the coroutine will not do that. You need to use RigidbodyConstraints.None for that.

So the easiest way to do this imo, is to check the checkbox for x position in the inspector for your rigidbody, then start your coroutine “Wait()” which will look like this:

IEnumerator Wait(){
yield return new WaitForSeconds(3);
rb.constraints = RigidbodyConstraints.None;

Thanks for reply, it works.