Accessing Transform data from “OnDestroy” during an Undo operation is no longer allowed. Transforms are detached from each other and reassembled during Undo operations so we can therefore no longer return any transform data like position and rotation during Undo operations. Instead a better error messsage is now logged so it can be fixed on from the client side: "Transform cannot be used during an Undo operation. Use 'Undo.isProcessing' to check before accessing."
Example code for a Monobehaviour that is fixed up and handles the Undo case:
[ExecuteAlways]
public class test : MonoBehaviour
{
void OnDestroy()
{
#if UNITY_EDITOR
if (!Undo.isProcessing)
Debug.Log("Editor: " + transform.position);
#else
Debug.Log("Player: " + transform.position);
#endif
}
}