static CreateRigWithUndo()
 {
     CinemachineFreeLook.CreateRigOverride
         = (CinemachineFreeLook vcam, string name, CinemachineVirtualCamera copyFrom) =>
         {
         // Create a new rig with default components
         GameObject go = InspectorUtility.CreateGameObject(name);
         Undo.RegisterCreatedObjectUndo(go, "created rig");
         Undo.SetTransformParent(go.transform, vcam.transform, "parenting rig");
         CinemachineVirtualCamera rig = Undo.AddComponent <CinemachineVirtualCamera>(go);
         Undo.RecordObject(rig, "creating rig");
         if (copyFrom != null)
         {
             ReflectionHelpers.CopyFields(copyFrom, rig);
         }
         else
         {
             go = rig.GetComponentOwner().gameObject;
             Undo.RecordObject(Undo.AddComponent <CinemachineOrbitalTransposer>(go), "creating rig");
             Undo.RecordObject(Undo.AddComponent <CinemachineComposer>(go), "creating rig");
         }
         return(rig);
         };
     CinemachineFreeLook.DestroyRigOverride = (GameObject rig) =>
     {
         Undo.DestroyObjectImmediate(rig);
     };
 }