I have an interactable object that spawns a menu on top of it when clicked, this is it’s code:
private void OnMouseUpAsButton()
{
RadialMenuSpawner.ins.SpawnMenu(this);
}
the menu contains several Images that should change a variable of the object and close (destroy) the menu, the problem is that when I click on one of them to close it, the menu opens again (I’m thinking it’s because i have the menu image on top of the object), here is the image script:
public void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (selected)
{
Debug.Log(selected.title + " was selected");
}
Destroy(gameObject);
}
}
Is there a way to prevent this kind of behaviour?
I want to be able to close the menu and open it again but not on the same mouse click, I tried changing the MouseDown to MouseUp but then the menu doesn’t show up at all (maybe opening and closing on the same frame idk).