title: In Unity, How can I serialize an object at Edit time, and also bind the object fields to UI
body: <p>I am writing a design-time level editor.</p>
  <p>I would like my levels to be defined in JSON, and loaded/saved using Json serialization (Probably NewtonSoft)</p>
  <p>The issue I have is this:</p>
  <ul>
  <li><p>In order to have the objects be serializable, they cannot be Unity Objects (e.g. ScriptableObject) (and, indeed, I don’t need them to be – except</p>
  </li>
  <li><p>In order to bind custom editor stuff to the object’s properties, the objects need to be unity Objects.</p>
  </li>
  </ul>
  <p>I can’t figure out what to do – and figured people must be doing something similar, but my Google skills are failing me (and I have googled A LOT!</p>
  <p>As a really simple example:</p>
  <ol>
  <li>I have a class called <code>Level</code>, with a <code>string</code> field called <code>LevelName</code></li>
  <li>I have an <code>EditorWindow</code> which has a reference the current Level instance</li>
  <li>If <code>Level</code> is a <code>MonoBehaviour</code>, I can say
  <code>_so = new SerializedObject(_level);</code> and I can bind a field in my UI to the <code>LevelName</code> field</li>
  <li>That works fine – but now I want to save the data – but when I try to serialise it I get an error:</li>
  </ol>
  <blockquote>
  <p>NotSupportedException: rigidbody property has been deprecated</p>
  </blockquote>
  <p>This, my searching tells me, is simply because you can’t serialize unity Object.</p>
  <p>But if I change Level to be a POCO (i.e. not inheriting from anything) then the binding doesn’t work because _level is not a UnityEngine.Object</p>
  <p>I feel I may be missing something really obvious, but for the moment I am stuck and would really appreciate any help or advice.</p>