It's working fine when the game is already running. I can change each door lock state. But before running the game is I set one or more of the doors to be locked( Checked set the flag to true ) and then running the game it's changing all the doors back to false unlocked.

I want that if I set the doors lock state also before running the game that it will keep this changes when the game is running.

The first script is with one line only:

```
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class DoorsLockManager : MonoBehaviour
{
    public List<HoriDoorManager> Doors = new List<HoriDoorManager>();
}

```

The second script control the doors:

```
using UnityEditor;

[CustomEditor(typeof(DoorsLockManager))]
public class DoorsLockManagerEditor : Editor
{
    DoorsLockManager _manager;

    public override void OnInspectorGUI()
    {
        _manager = (DoorsLockManager)target;

        base.OnInspectorGUI();

        if (_manager.Doors.Count <= 0)
            return;
        for (var i = 0; i < _manager.Doors.Count; i++)
        {
            if (_manager.Doors[i] == null)
                continue;

            _manager.Doors[i].GetLockState = EditorGUILayout.Toggle("Door " + i + " Lockstate", _manager.Doors[i].GetLockState);
        }
    }
}

```

The last script is attached to each door:

```
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System;

public class HoriDoorManager : MonoBehaviour
{
    public List<DoorHori> doors = new List<DoorHori>(); 
    public bool doorLockState;

    private void Awake()
    {
        if (transform.parent != null)
        {
            Transform parent = transform.parent;
            var children = parent.GetComponentsInChildren<Transform>();

            if (children != null)
            {
                foreach (Transform door in children)
                {
                    if (door.name == "Door_Left" || door.name == "Door_Right")
                        doors.Add(door.GetComponent<DoorHori>());
                }
            }
            //ColorDoors(Color.red, Color.green, doorLockState);
        }
    }

    void OnTriggerEnter()
    {
        if (doorLockState == false)
        {
            if (doors != null)
            {
               for(int i =0; i < doors.Count; i++)
                {
                    doors[i].OpenDoor();
                }
            }
        }
    }

    private void ColorDoors(Color red, Color green, bool state)
    {
        List<Transform> children = new List<Transform>();

        for (int i = 0; i < doors.Count; i++)
        {
            foreach (Transform child in doors[i].GetComponentsInChildren<Transform>())
            {
                if (child == doors[i].transform)
                    continue;

                var renderer = child.GetComponent<Renderer>();
                renderer.material.shader = Shader.Find("Unlit/ShieldFX");

                if(state == true)
                {
                    renderer.material.SetColor("_MainColor", red);
                }
                else
                {
                    renderer.material.SetColor("_MainColor", green);
                }
            }
        }
    }

    public bool GetLockState
    {
        get { return doorLockState; }
        set { doorLockState = value; }
    }
}

```