how to make a flip flop in unity code example
Example: unity t-flip flop
private bool onoff = false;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
onoff = !onoff; // toggles onoff at each click
if (onoff)
{
print("left");
}
else
{
print("right");
}
}