I made an if statement that turns a door on and off when a variable is equal to 0 (because multiple buttons control the same door. It turns off just fine but doesnt turn on again when the variable’s value is 0. Why not?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GivetoGrid : MonoBehaviour
{
public int gridcount;
public GameObject grid;
void Update()
{
if (gridcount != 0)
{
grid.SetActive(false);
}
if (gridcount == 0)
{
grid.SetActive(true);
}
}
}