My problem now is that when the ball enters a trigger all hatches that were closed are opened when it was suppose to be for one specific hatch.
Here’s a picture on what I’m trying to illustrate:

The brown rectangle between the blue and purple ramp are the hatches, the silver T’s are the plungers, and the white lines between the blue border and yellow triangle are the hatch triggers.
Here are snippets of my scripts for the hatches, hatch triggers, and plungers.
HatchMove (Animation of Hatch; dependent on HatchTrigger)
[SerializeField] private HatchTrigger[] HatchTrig;
private Rigidbody[] Hatch;
void Awake()
{
Hatch = new Rigidbody[2];
Hatch[0] = GameObject.Find("1P_LeftHatch").GetComponent<Rigidbody>();
Hatch[1] = GameObject.Find("1P_RightHatch").GetComponent<Rigidbody>();
for (int i = 0; i < 2; i++)
{
Hatch[i].rotation = Quaternion.identity;
}
HatchTrig = new HatchTrigger[2];
HatchTrig[0] = GameObject.Find("1P_LeftHatchTrigger").GetComponent<HatchTrigger>();
HatchTrig[1] = GameObject.Find("1P_RightHatchTrigger").GetComponent<HatchTrigger>();
}
void FixedUpdate()
{
if (HatchTrig[0].IsHatchClosed == false) Hatch[0].rotation = Quaternion.identity;
else Hatch[0].rotation = Quaternion.AngleAxis(60, Vector3.down);
if (HatchTrig[1].IsHatchClosed == false) Hatch[1].rotation = Quaternion.identity;
else Hatch[1].rotation = Quaternion.AngleAxis(60, Vector3.up);
}
HatchTrigger (Sends signal to HatchMove to open/close)
private HatchTrigger[] HatchTrig;
public bool IsHatchClosed { get; set; }
void Awake()
{
HatchTrig = new HatchTrigger[2];
HatchTrig[0] = GameObject.Find("1P_LeftHatchTrigger").GetComponent<HatchTrigger>();
HatchTrig[1] = GameObject.Find("1P_RightHatchTrigger").GetComponent<HatchTrigger>();
}
void OnTriggerEnter(Collider other)
{
if (HatchTrig[0].IsHatchClosed == true) HatchTrig[0].IsHatchClosed = false;
if (HatchTrig[1].IsHatchClosed == true) HatchTrig[1].IsHatchClosed = false;
}
PlungerMove (Sends signal to HatchTrigger after animation)
[SerializeField] private HatchTrigger[] HatchTrig;
void Awake() {
HatchTrig = new HatchTrigger[2];
HatchTrig[0] = GameObject.Find("1P_LeftHatchTrigger").GetComponent<HatchTrigger>();
HatchTrig[1] = GameObject.Find("1P_RightHatchTrigger").GetComponent<HatchTrigger>();
}
void FixedUpdate()
{
if (r.position.x > 0) {
if (_state == PlungerState.Retracting)
r.MovePosition(r.position + RetractedOffset * Vector3.left * Time.deltaTime);
else if (_state == PlungerState.Receding)
r.MovePosition(r.position + RetractedOffset * Vector3.right * Time.deltaTime);
if (Vector3.Distance(startPosition, r.position) >= setDistance)
_state = PlungerState.Receding;
/* After plunger is triggered and returns to resting position, activate the isHatchedClosed switch.*/
else if (Vector3.Distance(startPosition, r.position) == 0 && _state == PlungerState.Receding)
{
_state = PlungerState.Resting;
if (r.name == "1P_LeftPlunger") HatchTrig[0].IsHatchClosed = true;
if (r.name == "1P_RightPlunger") HatchTrig[1].IsHatchClosed = true;
}
}
}