Unity多個button,一次只能點一個

ㄐ羽
請問當有六個按鈕,點擊第一個button時換button的sprite,再來點擊另一個時也換button的sprite,然後同時第一個按鈕會恢復原來的button的sprite,程式碼要如何更改?!

  public Button mybutton; //定義按鈕
    public Sprite UP;
    public Sprite Down;
    private int countet = 0;

    // Start is called before the first frame update
    void Start()
    {
        mybutton = GetComponent<Button>();
    }

    public void ChangeButton()
    {
        countet++;
        if(countet%2==0)
        {
            mybutton.image.overrideSprite = UP;
        }
        else
        {
            mybutton.image.overrideSprite = Down;
        }
    }
請輸入程式碼


回到頂部