Go to the offending line of code and make it look like this:
#if UNITY_EDITOR
Unity.Undo.RegisterCreatedObjectUndo()
#endif
Don't replace the Unity.Undo thing though, just add the other two lines, exactly as typed above.
This is supposedly fixed in an update, but I haven't updated yet.