How to fix the rotation of two objects?

Newbie to unity here.
I have the main camera moving around fine but I need a cube to match the rotation of the camera.
How would I do this?
Any help is greatly appreciated thanks.

You just need to set your cube transform’s rotation equal to your camera transform’s rotation. replace “cube” and “camera” with the references to those game objects in your script.

cube.transform.rotation = camera.transform.rotation;