I figues that this would be really straightforward but it seems not.
I have two objects
CubeObject (Just a cube in my scene)
Camera (My main camera)
I want CubeObjects Y rotation to be the Z rotation of the Camera
this is a script which I place on my CubeObject
transform.rotation = new Quaternion(Camera.main.transform.rotation.x, Camera.main.transform.rotation.y, Camera.main.transform.rotation.y, Camera.main.transform.rotation.w);
It seems as if will work while i rotate the camera through its y axis but then everything goes crazy and the cube turn in a weird direction