LoginSignup
3
1

More than 5 years have passed since last update.

Unity2017.1のRaycastバグ

Last updated at Posted at 2017-10-26

最近Unity2017.1に更新したんですが、さっそくバグを踏みました。

UI Button Issue after upgrading to 2017.1
https://forum.unity.com/threads/ui-button-issue-after-upgrading-to-2017-1.488407/

これは私が投稿したものではないですが、症状は同じで、uGUIのUIオブジェクトのタッチ(マウスクリック)が効かなくなることがあるというもの。

さっくり原因を書くと、ImageやButtonなどのUIオブジェクトのScale.x, Scale.y, Scale.zのいずれかがゼロの場合に、Raycastの範囲が各軸の全体に広がってしまい、他のRaycastTargetへのタッチを邪魔してしまうということのようです。

例えばアニメーションでImageを消すのにScaleを使ったり、Scaleを指定するのにVector3ではなくVector2を使っている場合に発生します(Scale.zが0.0fになるため)。ただ、オブジェクトのツリー構成によっては発生しないこともあるようです。

Unity2017.2では修正されているようですが、こちらではまだ確認していません。
https://unity3d.com/jp/unity/whats-new/unity-2017.2.0

UI: Fixed case of object scale interfering with input.

取り急ぎご連絡まで。

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