doorclass = new DoorClass[doors.Length];
This line removes any blocking status information that you may have had previously and creates a new matrix from scratch. So, if your plan was to use the data that you had created in the inspector at the time of editing, you simply lost it.
class of door[i] = new DoorClass ();
This line creates a new instance of
Class of door type, with default values. The default value of a
bool It's false. So the value of
blocking status in this case it is always false,
Your next line applies this always false value to the i-th gate:
Doors[i].doorLockState = doorclass[i].lockState;
Boolean values are a type of value, which means that when you do this, you are copying the false value from
class of door[i].lockState to
Doors[i].doorLockState, not creating a reference from the door to the bool in its matrix.
Since you never verify
class of door[i].lockState again, changing this value in the inspector later will not change the behavior of the door. He still has his own copy of the false value and does not know anything about the
Class of door instance that you created for it.
I'm not sure what to tell you about how to solve this problem, because it's not clear how I expected this to work.
If you intended to create these blocking values ahead of time in the Inspector, you must delete the lines that create a new
Class of door Array and the default instances in
Start(), since that throws everything you wrote in editing time. However, this is a fragile method without real control over the order, and it would be easy for the collection of locking doors and locks to lose synchronization and cause errors such as an index out of range.
If you intended to fill in these blocking values in a procedural manner since their level is generated at runtime, then that procedure logic for determining the true or false blocking states must be executed before assigning the blocking values to the gates, instead to use the default false for all of them. .
If you intended to use this collection of bools as control panel to later change the states of the doors after
Start() has run, then you need some code to fire when the lock bool of the i-th door has changed and retransmit that state change to the i-th door. I would do it differently if I needed it to work for the editor's interaction through the Inspector (which seems to be suggested by the fact that he made this matrix public), rather than through the code (which I assume he would want to do). systemic game, but I see no evidence of this in its current sample), so again it is not clear from the current question what solution is appropriate for your needs here.