- Home /
2D raycast to UI problem
Hey,
So I have this weird issue with my raycast where it is hitting colliders that are not actually there. I have my UI with a few buttons down the bottom and i am raycasting to check if the button is hit, and if so ignore a function. The problem is for some reason in one scene the colliders seemed to have stretched as far left as possible.
If you look at my 2 amazing images, the first is where the buttons are located on screen, each with a collider the same size as the button, and the 2nd is the apparent new colliders on the screen. On scene view i can still see the colliders in their original size, but for some reason whenever i click in those areas i get a hit return for the buttons collider.
This same function is being used in a different scene, but without the issue.
Does anyone have any idea what the issue could be? I am using Unity 5.5.1f1 but also tried it in Unity 2017.2.0f3
Answer by draky · Dec 18, 2017 at 02:59 AM
Bump. Still stuck on this issue and have run out of ideas.
EDIT: I ended reworking my logic and ditching the raycasting for EventSystem.current.IsPointerOverGameObject().