Rezero or Recalibrate rotation of a game object

Is there any way to “rezero” or recalibrate the rotation of a gameobject?
Kind of like when you reset a scale to measure the weight of a liquid.
I want to set the rotation back to (0, 0, 0) without changing the actual rotation of the object.
I know that this can be accomplished with parent and child gameobjects, but I came across a forum post that stated that this was possible through the editor.

Here’s a script I use to reset all parts of a transform. Create it and put it in an Assets folder called Editor.

If you just want to reset the Rotation, just take out the lines for Position and Scale. Perhaps also change the MenuItem text as well. Shortcut key is set to be Shift-R.

Credit to @LorenzoValente for this code…

using UnityEngine;
using UnityEditor;

public class ResetTransform
    [MenuItem("GameObject/Reset Transform #r")]
    static public void MoveSceneViewCamera()
        GameObject[] selectedObjects = Selection.gameObjects;

        foreach (GameObject selected_object in selectedObjects)
            Undo.RegisterCompleteObjectUndo(selected_object.transform, "Reset game object to origin");

            Vector3 p_pos =;
            Quaternion p_rot = Quaternion.identity;
            Vector3 p_scale =;

            if (selected_object.transform.parent != null)
                p_pos = selected_object.transform.parent.position;
                p_rot = selected_object.transform.parent.rotation;
                p_scale = selected_object.transform.parent.localScale;

            selected_object.transform.position = + p_pos;
            selected_object.transform.rotation = Quaternion.identity * p_rot;
            selected_object.transform.localScale =;