How to solve problem involving RigidBody.Constrains

Well, i need to freeze my X rotation, Y rotation and Z position after i’ve created my gameobject. But for some reason only the last constraint i wrote (the z position) gets freezed, even if i’ve told my script to freeze all three of them. Here’s my code.

public List<GameObject> Mobs = new List<GameObject>();
	public GameObject Mob;
	// Use this for initialization
	void Start () 
		Mob = GameObject.CreatePrimitive(PrimitiveType.Cube);
		Mob.transform.localScale = new Vector3(1f, 1f, 1f);
		Mob.rigidbody.constraints = RigidbodyConstraints.FreezeRotationX;
		Mob.rigidbody.constraints = RigidbodyConstraints.FreezeRotationY;
		Mob.rigidbody.constraints = RigidbodyConstraints.FreezePositionZ;
		Mobs.Add(Instantiate(Mob, this.transform.position, Quaternion.identity) as GameObject);

Any ideas? Thanks for reading.

To solve this, you need to understand the concepts of bitmasks, and bitwise operations. Or, you can just read the Unity manual and they have an example right there:

I won’t vote you down this time, but next time check the script reference before you post here and expect someone else to solve your coding errors.