Answers for "unity t-flip flop"

C#
1

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");
            }
        }
Posted by: Guest on February-04-2020

C# Answers by Framework

Browse Popular Code Answers by Language