using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enableDisableShop : MonoBehaviour
{
public GameObject shopPanel;
private bool shopEnabled = true;
public void disableShop()
{
Debug.Log("you have disabled the shop panel");
shopPanel.SetActive(false);
shopEnabled = false;
}
public void enableShop()
{
Debug.Log("you have enabled the shop panel");
shopPanel.SetActive(true);
shopEnabled = true;
}
private void FixedUpdate()
{
if (Input.GetKeyDown("b"))
{
if (shopEnabled == true)
{
disableShop();
}
if (shopEnabled == false)
{
enableShop();
}
}
}
}
I want to disable the shop menu when i press B and re-enable again when i press B again.
The problem it’s that whenever i press B it just disables and re-enables it.