I have a script with booleans that are called activeone and activetwo my script supposed to switch between true and false but it doesn’t
using UnityEngine;
public class button : MonoBehaviour
{
public bool doorsstayactive;
public GameObject[] acitvedoors;
public GameObject[] notactivedoors;
public bool activeone = true;
public bool activetwo = false;
public void Doors()
{
print("working");
if (activeone == true)
{
activeone = false;
}
else
{
activeone = true;
}
foreach (GameObject door in acitvedoors)
{
door.SetActive(activeone);
}
if (activetwo == false)
{
activetwo = true;
}
else
{
activetwo = false;
}
foreach (GameObject door in notactivedoors)
{
door.SetActive(activetwo);
}
}
public void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "buttontrigger")
{
Doors();
}
}
public void OnTriggerExit2D(Collider2D collision)
{
if(collision.tag == "buttontrigger" && doorsstayactive == false)
{
Doors();
}
}
}
and know the public void doors is working because it prints working so only the booleans aren’t working