UObject destructor in BPs

I did that, but problem is that I don’t know how to call a function like that when the UObject is going to be destroyed.
I partially solved the problem calling an “UndoModifications()” function when a specific Actor causes the object to be destroyed, but it’s not optimal because if, for any reason, the object will leave play in other circumstances I can’t be sure the “UndoModifications()” function will be called.