title: Is there a method that would be called right before the serialization of the object in Unity3D?
body: <p>There is a class that have data that cannot be serialized easily. But, I can prepare it to serializable form. 
  So, is there any method to override that will be called right before serialization to prepare data?</p>
  
  <pre><code>[System.Serializable]
  public MyCalss {
      //Unity can serialise this list;
      public List&lt;int&gt; serializableData;
  
      //class contains a lot of data that cannot be serialized by Unity3D
  
      protected override void OnSerialize() { // &lt;-- looking for this method
           //pack all my data into the serializableData array
      }
  }
  
  public Behaviour: MonoBehaviour {
      MyClass instanceOfMyClass; // will be serialized by Unity3D
  }
  </code></pre>