Detecting serialization reload in editor

Is there a good way to detect that Unity is about to reload assets before the reload happens? In essence, to be notified when Unity is moving all of the Mono state into C++ and then back?

It is pretty easy to detect it has happened after the fact;

class UnitySerializationDetector {
  private object obj;

  void Awake() {
    obj = new object();

  void Update() {
    if (obj == null) {
      Debug.Log("Assets reloaded");
      obj = new object();

but is there a way to do it before the serialization happens?


I am not sure if this is what you’re looking for, have you tried this:Unity - Scripting API: ISerializationCallbackReceiver