Object rotation as a children of the main camera


I have a problem with the rotation of an object (simple arrow for the minimap). The object is attached to the camera as a children, so it takes the movement and the rotation from there. What i would like to do, is to make the object stop rotating up and down only left and right.(I tried with Rigidbody freeze rotation on X, but its not working) I would attache the arrow as a children to the FPSController, but Im using Cinemachine in this scene so I need to attache to the main camera. thank you for your answers in advance! Have a nice day, Tamas

You could just point in the same direction constrained to the plane you want via Vector3.ProjectOnPlane().

Vector3 direction = Vector3.ProjectOnPlane(Camera.main.transform.forward, Vector3.up);
Quaternion rot = Quaternion.LookRotation(direction, Vector3.up);