title: Can't change public variables on a script attached to a gameobject. Values are restored upon play
body: <p>Here is my first question. Haven't been able to find anything on the topic.</p>
  
  <p>I want to create an editor script that changes a number of public bools in a script that is attached to a GameObject. </p>
  
  <p>I have this script attached to a GameObject. The GameObject is a prefab:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class ScriptWithPublicBools : MonoBehaviour {
  
      public bool b1;
      public bool b2;
  }
  </code></pre>
  
  <p>And here is my editor script:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEditor;
  
  public class EditorHelper : ScriptableObject
  {
      [MenuItem("Trace/Trace")]
      public static void trace()
      {
          foreach (GameObject g in Selection.gameObjects)
          {
              ScriptWithPublicBools tb = g.GetComponent&lt;ScriptWithPublicBools&gt;();
  
              if (tb)
              {
                  tb.b1 = false;
                  tb.b2 = true;
              }
          }
      }
  }
  </code></pre>
  
  <p>The scripts are working fine and the bools on the gameobject is set correctly in the editor. But when I press the PLAY button the values of the two bool switches back the  values they were before the script was applied. </p>
  
  <p>It does not matter what the values of the prefab is, the values are just restored to the values before applying the editor script.</p>
  
  <p>Am I doing something wrong or is it a bug?</p>
  
  <p>If I apply the editor script, save the scene as a new scene, and open the newly created scene the values are also wrong.</p>
  
  <p>BUT, if the GameObject is not a prefab all works perfectly, and the values keep their values given by the editor script, even after initiating play mode.</p>
  
  <p>So the problem is only present when using prefabs.</p>