0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

uGUIのToggleを使ってみる

Last updated at Posted at 2020-05-09

uGUIで何か作ろうとした

久しぶりにuGUIで何か作ろうとしたらすっかり忘れていました。

例えばToggleボタン…

こうゆうのです。

適当なメソッドを作っておいて…

ToggleButton.cs

    public void OnClickToggleButton(bool isOn)
    {
    // Toggleのチェックボックスがクリックされた時に値を取得する
        Debug.Log("Toggleの値: " + isOn);

    }

ToggleコンポーネントのOnValueChangedのところに設定します。

この時に上のほうにあるメソッドを選択するとToggleの値が取得できます。

下にあるOnClickToggleButton(bool)だとチェックしているか否かの値は取得できません。

Inspector上で設定された値になります。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?