CreateInstanceFromType is not allowed to be called during serialization

Hi!

I am learning the serialization in Unity. I read this article and such error is presented. The full error description is:

CreateInstanceFromType is not allowed to be called during serialization, call it from OnEnable instead. Called from ScriptableObject ‘MyWindow’.
See “Script Serialization” page in the Unity Manual for further details.
UnityEngine.ScriptableObject:CreateInstance()
SerializeMe:.ctor() (at Assets/Assets/Scripts/Editor/SerializeMe.cs:30)

I’ve attached the [93621-assets.zip|93621] for you to take a look.

It happens when I do:

  1. Open Window->Serialization
  2. Press Play.

Thank you in advance.

Thanks to friends from the chat I’ve found the solution. It is explained here.