LoginSignup
15
18

More than 5 years have passed since last update.

透明なボタンを透明なイメージで作らない.

Posted at

タイトルでよくある,クリックしたらメニューに移動するやつ.

test.gif

こちらの記事で紹介されていた,全画面タッチの方法
http://qiita.com/sevenstartears/items/5004cd913578fa78e6ea

今まで,Imageを透明にして全画面タッチを実装してきたので,Graphicを継承するだけでよかったというのは衝撃でした.

具体的には以下のようなクラスを作成します,

using UnityEngine;
using UnityEngine.UI;

public class RaycastDetector : Graphic {

    protected override void Reset()
    {
        this.color = new Color(0, 0, 0, 0);
    }
}

OnClickの検知にはButtonほどたくさんの機能は不要なので,EventTriggerを使います.

スクリーンショット 2017-07-09 0.54.18.png

全画面にする
スクリーンショット 2017-07-09 0.55.16.jpg
|

15
18
5

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
15
18