SetActive(false) not working in void Start()

The problem I am having is that the collisionCheck (Empty) GameObject does not disable even though it is called to be disabled in void Start(). The same code worked just fine for another object and I do not understand why it suddenly does not work for this one. I’m ready to give more info if needed

Can someone help?

void Start()
{
    Station.SetActive(false);
    collisionCheck.SetActive(false);
}

void Update()
{
    powerDisplay.text = power.ToString();

    if (Input.GetKeyDown(KeyCode.E) && power > 0)
    {
        power -= 1;
    }
    if (power == 0)
    {
        Station.SetActive(true);
    }
    if (collisionCheck.activeSelf == true && Input.GetKeyDown(KeyCode.F))
    {
        power = 3;
        collisionCheck.SetActive(false);
    }
}

void OnTriggerEnter(Collider Station)
{
    collisionCheck.SetActive(true);
}

void OnTriggerExit(Collider Station)
{
    collisionCheck.SetActive(false);
}
1 Like

I would say that the Start is deactivating the collisionCheck correctly, but OnTriggerEnter is activating it again. You may want to try commenting the OnTriggerEnter to check if thats the case.

(Note that on your OnTriggerEnter you call Station to the collider, but this not guarantee that the collider is the Station)