Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我认为标题不言自明。我正在使用 2D Colliders,它们位于相同的 Z 位置。如果您也单击另一个对象的对撞机,则不会触发 OnMouseDown()。这很烦人。想法?
至少对我来说,它总是在其中一个对象上触发,但我无法选择哪一个。
作为一种解决方法,您可以添加一个带有 3D 碰撞器的子游戏对象(例如Box Collider)。孩子是必需的,因为 2D 和 3D 对撞机不能附加到同一个游戏对象。使 3D 对撞机向相机扩展一点。在这种情况下,总是调用子游戏对象 OnMouseDown()。
Box Collider