Need help comparing a game object to an element in an array

Hi, so I am currently making a game where if a certain arrows spawns, the player needs to press the corresponding arrow key on a keyboard to get a point and spawn the next one. If you press the wrong key or take too long you’ll be sent to a game over screen.
I’ve gotten everything to work except the buttons. Right now when an arrow spawns and you press the corresponding button nothing happens. I know the If statement isn’t working but I don’t know why.
Thank you in advance for the help.
Here’s the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Arrows : MonoBehaviour
{
    public GameObject[] myArrows;
    public float gameOverTimer = 0;
    private bool arrowPresent = false;
    public GameObject spawnedArrow;
    public int score = 0;
    public Text currentScoreText;
    // Start is called before the first frame update
    void Start()
    {
        
        int randomIndex = Random.Range(0, myArrows.Length);
        Vector3 arrowPosition = new Vector3(0, 0, 0);
        spawnedArrow = Instantiate(myArrows[randomIndex], arrowPosition, Quaternion.identity);
        arrowPresent = true;
        
    }

    // Update is called once per frame
    void Update()
    {


        if (arrowPresent == false)
        {
            int randomIndex = Random.Range(0, myArrows.Length);
            Vector3 arrowPosition = new Vector3(0, 0, 0);
            spawnedArrow = Instantiate(myArrows[randomIndex], arrowPosition, Quaternion.identity);
            arrowPresent = true;
            gameOverTimer = 0;

            if ((spawnedArrow == myArrows[0] || spawnedArrow == myArrows[7]) && Input.GetKeyDown(KeyCode.DownArrow))
            {
                Destroy(spawnedArrow);
                arrowPresent = false;
                score += 1;
            }
            else
            {
                SceneManager.LoadScene(2);
            }


            if ((spawnedArrow == myArrows[1] || spawnedArrow == myArrows[6]) && Input.GetKeyDown(KeyCode.LeftArrow))
            {
                Destroy(spawnedArrow);
                arrowPresent = false;
                score += 1;
            }
            else{
                SceneManager.LoadScene(2);
            }


            if ((spawnedArrow == myArrows[2] || spawnedArrow == myArrows[5]) && Input.GetKeyDown(KeyCode.RightArrow))
            {
                Destroy(spawnedArrow);
                arrowPresent = false;
                score += 1;
            }
            else
            {
                SceneManager.LoadScene(2);
            }


            if ((spawnedArrow == myArrows[3] || spawnedArrow == myArrows[4]) && Input.GetKeyDown(KeyCode.UpArrow))
            {
                Destroy(spawnedArrow);
                arrowPresent = false;
                score += 1;
            }
            else
            {
                SceneManager.LoadScene(2);
            }
        }
        else
        {
            gameOverTimer += Time.deltaTime;
            
            if (gameOverTimer >= 4)
            {
               SceneManager.LoadScene(2);
                
            }
        }

       
    }
}

ok, i’ve gotten the code to a point where pretty much everything works now. I tested the code and found the cause of the problem is the arrowNumber == myArrows[_] part in the if statements. Does anyone know of a way i can check if the current arrow is an up arrow etc.
heres the code right now:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Arrows : MonoBehaviour
{
    public GameObject[] myArrows;
    public float gameOverTimer = 0;
    private bool arrowPresent = false;
    public GameObject spawnedArrow;
    public int score = 0;
    public Text currentScoreText;
    public GameObject arrowNumber;
    // Start is called before the first frame update
    void Start()
    {
        
        int randomIndex = Random.Range(0, myArrows.Length);
        Vector3 arrowPosition = new Vector3(0, 0, 0);
        spawnedArrow = Instantiate(myArrows[randomIndex], arrowPosition, Quaternion.identity);
        arrowPresent = true;
        
    }
    void noArrow()
    {
      
            int randomIndex = Random.Range(0, myArrows.Length);
            Vector3 arrowPosition = new Vector3(0, 0, 0);
            arrowNumber = myArrows[randomIndex];
            spawnedArrow = Instantiate(arrowNumber, arrowPosition, Quaternion.identity);
            arrowPresent = true;
            gameOverTimer = 0;

       
    }

    // Update is called once per frame
    void Update()
    {

        if (arrowPresent == true)
        {
            gameOverTimer += Time.deltaTime;

            if (Input.anyKeyDown)
            {
               

                    if ((Input.GetKeyDown(KeyCode.DownArrow)) && (arrowNumber == myArrows[0] || arrowNumber == myArrows[7]))
                    {
                        Destroy(spawnedArrow);
                        arrowPresent = false;
                        score += 1;
                        noArrow();
                    }
                    else
                    {
                        SceneManager.LoadScene(2);
                    }


                    if ((arrowNumber == myArrows[1] || arrowNumber == myArrows[6]) && Input.GetKeyDown(KeyCode.LeftArrow))
                    {
                        Destroy(spawnedArrow);
                        arrowPresent = false;
                        score += 1;
                        noArrow();
                    }
                    else
                    {
                        SceneManager.LoadScene(2);
                    }


                    if ((arrowNumber == myArrows[2] || arrowNumber == myArrows[5]) && Input.GetKeyDown(KeyCode.RightArrow))
                    {
                        Destroy(spawnedArrow);
                        arrowPresent = false;
                        score += 1;
                        noArrow();
                    }
                    else
                    {
                        SceneManager.LoadScene(2);
                    }


                    if ((arrowNumber == myArrows[3] || arrowNumber == myArrows[4]) && Input.GetKeyDown(KeyCode.UpArrow))
                    {
                        Destroy(spawnedArrow);
                        arrowPresent = false;
                        score += 1;
                        noArrow();
                    }
                    else
                    {
                        SceneManager.LoadScene(2);
                    }
                }

                if (gameOverTimer >= 4)
                {
                    SceneManager.LoadScene(2);
                }
            
        }
    }
}

I think you are comparing the prefab with the instantiated object. Those are not the same object, and default == operator is equal to calling object.ReferenceEquals(). Instead, you could remember which prefab you have instantiated - either a reference to the prefab, or its index in the array, and just compare that.