GameObject.SetActive(false); not working

//Switches to the Register Screen
public void registerScreenPressed()
{
loginScreen.SetActive(false);
registerScreen.SetActive(true);
activeScreen = “Register Screen”;
changeConsoleText();
}

Whenever I try to hide the loginScreen GameObject it doesn’t hide. Is there anything wrong

You have to provide the rest of code where you call registerScreenPressed() and SS of inspector of gameobject that this script attached to it to check whether you added the right gameobject to loginScreen or not, so I could help you ^^

@ManoKristos Here is the screenshots

@ManoKristos I have also disabled it on Awake(), but I use a seperate gameobject script to show the GameObject later

I have narrowed it down to this line of code in a separate script
//Decleration of Animator
[Header(“Animator”)]
[SerializeField]
private Animator anim;

    //Decleration of Holder
    [Header("Holder")]
    [SerializeField]
    private GameObject bannerScreenHolder;

    //Decleration of Login Screen Holder
    [Header("Login Screen Holder")]
    [SerializeField]
    private GameObject loginScreenHolder;

    //Decleration of variables
    private int tick;
    public int delay = 5;

    //Awake is the first thing called
    private void Awake()
    {
        loginScreenHolder.SetActive(false);
        bannerScreenHolder.SetActive(true);
    }

    //Fixed Update is called once every 0.02 seconds or 50 times
    private void FixedUpdate()
    {
        //If delay seconds have passed
        if(tick == (delay * 50))
        {
            anim.SetInteger("setAnimState", 1);
        }
        //After Animation plays (5 seconds)
        else if(tick == (delay * 50) + 250)
        {
            anim.SetInteger("setAnimState", 2);
            bannerScreenHolder.SetActive(false);
            loginScreenHolder.SetActive(true);
            return;
        }

        tick++;
    }

I’ve found the problem. Apparently, I needed an extra check here:

else if(tick == (delay * 50) + 250 && loginShown == false)
        {
            anim.SetInteger("setAnimState", 2);
            bannerScreenHolder.SetActive(false);
            loginScreenHolder.SetActive(true);
            loginShown = true;
            return;
        }