I am a beginner at C# so I apologize in advance for any stupid questions
But anyway, I tried to make a door toggle in unity; just a simple one with no animations, but for some reason it will not toggle on and off, here is the code:
public class DoorOpen : MonoBehaviour
{
public GameObject Door;
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Door.SetActive(false);
}
if (Door.SetActive = false)
{
if (Input.GetKeyDown(KeyCode.Space))
{
Door.SetActive(true);
}
}
}
}