title: Serialize Script Instance in a ScriptableObject in Unity
body: <p>I know this can be done because the amazing plugin <a href="https://odininspector.com/" rel="nofollow noreferrer">Odin</a>, has some epic serialization tools.</p>
  
  <p>I was hoping I could do this using Odin but even their [Serialize] tag doesn't work.</p>
  
  <p>I want to serialize a new instance of a script inside of a Scriptable Object. </p>
  
  <p>With Odin, you can serialize dictionaries, and if you serialize a dictionary which holds instance of an interface (script) it allows you to create a new instance of that script inside the dictionary like so:</p>
  
  <p><a href="https://i.stack.imgur.com/kqIDC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kqIDC.png" alt="enter image description here"></a></p>
  
  <p>Since its possible to store an instance of a script inside of a dictionary I am curious how this can be done on its own. </p>
  
  <p>The script I want to save is a generic script with only functions and an empty constructor.</p>
  
  <p>Do you know a why to serialize the instance of an interface (script) inside of a ScriptableObject?</p>
  
  <p>Ideally I could create an attribute some how and just force it to serialize like so:</p>
  
  <pre><code>public class MyClass: MonoBehaviour
  {
      [ForceSerialize]
      public IScript scriptToSerialize;
  
  }
  </code></pre>
  
  <p>And then in the inspector I could just click the box and create a new instance of that script to be attached to the object.</p>