1
2

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.

unity > 選択中を示すものを作る > Toggleの使用

Last updated at Posted at 2015-09-05
動作確認
Unity 5.1.2-f1 on MacOS X 10.8.5

こういうのを作りたい。
黄色は選択中ということを示している。

Main_unity_-150905-PageButton-PC__Mac___Linux_Standalone__Personal.jpg

手順

UI > Toggleを追加

Toggle > Background > Checkmarkを選択し、SourceImageをBackgroundにする
同じくColorを黄色にする

Main_unity_-150905-PageButton-PC__Mac___Linux_Standalone__Personal.jpg

ToggleのWidth,Heightを(45, 45)にする
BackgroundのWidth,Heightを(40, 40)にする
CheckmarkのWidth, Heightを(35, 35)にする
こうすることで、以下のようになる。

Main_unity_-150905-PageButton-PC__Mac___Linux_Standalone__Personal.jpg

LabelのTextを P1 とする
Labelの位置を変更して以下のようにして完成

Main_unity_-150905-PageButton-PC__Mac___Linux_Standalone__Personal.jpg

用途

以下のようにして、現在選択しているものが分かるようにする。

Main_unity_-150905-PageButton-PC__Mac___Linux_Standalone__Personal.jpg

以下のページにあるように、トグルグループを使えば一つだけ選択することができる。
http://dkoubou2.chips.jp/dkoubouz/2015/04/unity_togglegroup_tutorial.html

トグルグループにしたら全選択解除ができない。それはそれで正しいのかもしれない。

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?