to be sure, that x is a valid value. You could also use Debug.Log(x, gameObject), to find out the value of x and the script it is called at. If you still have the problem afterwards, please post the whole error message.
Debug Log says the value of x is 0.
Here’s the whole error message:
"
NullReferenceException: Object reference not set to an instance of an object
Control.OpenDoor (Int32 x, UnityEngine.Animator anim) (at Assets/Scripts/Control/Control.cs:77)
DoorOpenCloseControl.Update () (at Assets/Scripts/Doors/DoorOpenCloseControl.cs:26)
"
(DoorOpenCloseControl.Update() is where I try to call OpenDoor() later on)
Control.Start is never called in DoorOpenCloseControl.Start so the array is never populated. If you want to inherit that behavior then make Control.Start protected virtual and make DoorOpenCloseControl.Start protected override and call base.Start() inside it.
The start function on the base class is not executed, only the start function on the DoorOpenCloseControl class is. All your setup code in the base class is never run and your hasKey dictionary is null.