- Home /
GraphicRaycaster UI event issue with Unity v5.2.0bx
Hello people!
I had such a joy when Unity 5.20b2 was out this last Friday! I was hoping so much that came to fix the GraphicRaycaster issue that appeared on 5.2.0b1 but without luck :(
The issue consist in that gui events are not been received at all in the current UI view, if you deactivate and activate the GraphicRaycaster they work fine, with the exception of having multiple canvas, like for instance having a gui window and displaying a modal view (in a upper layer) then the modal view never gets the events.
Does anyone knows a workaround for this, because they have addressed many of the main issues that we have with bundled scenes and they have also fixed the scripts references issue in bundled prefabs in this version, they also fixed the bundles for WebGL which are using atlases, they have been drastically reduced to almost 45%, such a great news!
Anyways, if someone knows a workaround would be of great help! I would love to use any of the 5.2.0 betas, otherwise I hope that at least the next beta does not take so long!!
This issue is still happening on Unity 5.2.0b4...
Only that now the events are not been processed in a secondary canvas only. If you deactivate and activate the GraphicRaycaster on the second canvas it works fine again.
Doing a regression to Unity v5.1.2f1, hmm... sad :(
Nothing came out in the release notes for neither Unity 5.2 Beta 6 nor Unity 5.2 Beta 5 regarding mouse UI inputs. In beta 5 they did fix some kind of issue regarding keyboard input for WebGL (is the last fix from the release notes of that post).
No idea why they did not look at mouse/touch input for Graphic Raycaster as well... anyway! I will try testing beta 6 later this week, I am tired of testing betas and this just does not gets solved! This is SO important, without multiple canvas responding to UI events our game is not functional.
We cannot use any of the major improvements of 5.2 in the betas just because of this.
Hope that when 5.2.0f1 arrives this finally gets solved! :)
I already posted this as a bug, you can check the bug report here.
Answer by lermy3d · Aug 24, 2015 at 07:33 PM
Hello guys, I just downloaded and install Unity 5.2.0f2, and this issue still persist, but here I am sharing a solution for this!
I have attached an script and a package containing a debug scene to test if the raycaster is working or not. (You need to have at least 2 sorting layers configured in your project since packages does not carry that configuration)
You can see 3 canvas in the Hierarchy, each one of them with a button and drawing in their own separate sorting layer. The third canvas though, it contains an image partially blocking events to buttons in lower canvases. I created an script that grabs the state of the raycaster sets his inverse value and restore it again.
Open the package on a new project an import it, just hit Play and move the mouse (or click) around the button area where the black image blocks the button on either canvas 1 or 2, and you can see it does turns green!
Stop playback and enable the "AutoEnableGraphicRaycast.cs" script on the 3rd canvas transform an hit play. This fixes this issue since the image blocking the input events is now doing his job, you will see how the button does not turns green by clicking or hovering the mouse on top of the blocker image!
This made me sad, is an obvious check Unity! Please fix this bug.
I am attaching this workaround for those having the same issue.
Best regards, Lermy