LoginSignup
0
1

More than 5 years have passed since last update.

UIの下に配置してあるSpriteにマウスイベントを発生させない方法

Last updated at Posted at 2017-01-04

OnMouseDownはUIの下に配置してあるSpriteにもマウスイベントが発生してしまう。
UIの下に配置してあるSpriteにマウスイベントを発生させたくない場合はOnMouseDownの代わりに
Physics 2D Raycasterを使う。

手順
1.カメラにPhysics 2D Raycasterをアタッチ
2.マウスイベントを発生させたいSpriteオブジェクトにEvent Triggerをアタッチ
3.Add New Event Typeから好きなイベントを追加

以上。

こちらの記事を参考にさせて頂きました。
http://qiita.com/seka/items/f9bfe60ccb0a5508ff49

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