title: Unity3D - Editor Window that can save data to an array that isn't cleared when you play
body: <p>I'm trying to create an editor window that's able to create in game items.
  It's supposed to add the item to a list of items that doesn't get cleared every time you play the game.</p>
  
  <p>Is it possible to do this without an external XML/JSON file to save the data in.</p>
  
  <p>I currently have this in my editor window script, ItemEquipable(type, price) is a basic class that just has a type and a price variable:</p>
  
  <pre><code>if(GUILayout.Button("Create"))
          ItemList.items.Add(new ItemEquipable(type, price));
  </code></pre>
  
  <p>And the ItemList class, ItemEquipable extends the base Item class.</p>
  
  <pre><code>using UnityEngine;
  using System.Collections.Generic;
  
  public class ItemList:MonoBehaviour {
      public static List&lt;Item&gt; items;
  }
  </code></pre>
  
  <p>I've attached the ItemList to a GameObject that's in the scene.</p>
  
  <p>I've seen <a href="http://answers.unity3d.com/questions/272871/custom-editor-how-to-initialise-a-new-array-elemen.html" rel="nofollow">Custom editor: How to initialise a new array element?</a> but that script extends Editor and I'm extending EditorWindow, so I don't have access to a target variable.</p>
  
  <p>Update:</p>
  
  <p>Okay so I've tried making the ItemList class serializable</p>
  
  <pre><code>using UnityEngine;
  using System;
  using System.Collections.Generic;
  
  [Serializable]
  public class ItemList:MonoBehaviour {
      public static List&lt;Item&gt; items;
  }
  </code></pre>
  
  <p>And making a singleton out of it</p>
  
  <pre><code>using UnityEngine;
  using System.Collections.Generic;
  
  public class ItemList:Singleton&lt;ItemList&gt; {
      public List&lt;Item&gt; items;
  
  }
  </code></pre>
  
  <p>With the Singleton being your basic singleton class/code</p>
  
  <p>Buth neither one is working.</p>