Question about HideFlags

How do you save HideFlags?

If I Selection.activeGameObject.hideFlags ^= HideFlags.NotEditable; ----- this is a toggle, and save and close the scene the flags do not save when I open the scene. This is in editor mode

Or how do you hideFlags in editor with the flags being saved once you close the scene?

using UnityEngine;
using UnityEditor;
using System.Collections;
[InitializeOnLoad]
public class Editor : EditorWindow
{

static void Init()
{
  var window = (Editor)EditorWindow.GetWindow( typeof( Editor ) );
  window.maxSize = new Vector2( 200, 100 );

}

public void OnGUI()
{
    if (GUILayout.Button("Lock/Unlock"))
     {
       Selection.activeGameObject.hideFlags ^= HideFlags.NotEditable;
     }
}
public void Update()
{
  Repaint();
}

}

Thank you
Alex Barbulescu

Seems like the HideFlags does not save on prefabs