- Home /
Why am I having UI Clickthrough in Builds with 5.2?
Hey guys,
I'm working on a 2D game that uses both sprites and the new UI system. Game sprites have a Sprite, a Collider2D, and a ClickSensor, which implements IPointerClickHandler:
UnityEvent onClick;
public void OnPointerClick (PointerEventData eventData)
{
onClick.Invoke();
}
The problem is, in either a standalone or a WebGL build (the two I've tried so far), I click through the UI elements without hitting them. Instead, I always hit the in game sprites underneath them. This wasn't happening before upgrading to 5,2, but I've made other changes to various parts of the project since then, so I don't know for sure if that's the problem.
Some more info:
The UI Canvas is in CameraSpace, it's on the layer UI, and the plane is 100 units from the camera. I've tried messing with the plane distance, but the problem happens regardless.
I have a GraphicRaycaster on my Canvas. BlockingObjects is None, BlockingMask is Everything.
I have a PhysicsRaycast2D on my camera with the EventMask set to Everything.
Any ideas would be much appreciated.
Your answer
Follow this Question
Related Questions
Touch Input on Sprites 1 Answer
GUI on canvas looks bad and pixelated 0 Answers
Determining GUI button pressed 2 Answers
When using input, array.Add replaces the last member 1 Answer
Gui Box - Texture - Spritesheet 0 Answers