transform.position not working (Sets position in just one axis)

Hi,
I have the below code in my program
This sets the object in the desired X & Z position, but not in the desired Y position.

		Vector3 centre = p_hitDetails.point;
		Vector3 displacement = new Vector3(0, minGrabSpaceHeight / 2, minGrabSpaceLength / 2);

		centre = centre + displacement ;

		GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
		cube.transform.position = centre;

When I change it to below.
It moves the object to the desired Y position. But I will be unable to place it in the desired Z position.

		Vector3 centre = p_hitDetails.point;
		Vector3 displacement = new Vector3(0, minGrabSpaceHeight / 2,  0);

		centre = centre + displacement ;

		GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
		cube.transform.position = centre;

What am I missing? Please advise.
Edit: The object is not a child of any object.

Thanks.

Hi Everyone.
I’m desperate for answers.
Attaching the screenshots for the two scenarios here.

Below are screenshots showing the position of the cube in the both scenarios I mentioned.
As you can see the cube is higher up when I did not include the Z movement.

Including movement in Z.

Without movement in Z