Can I use the mouse instead of the emulation pen to interact with UGUI?

0 votes
asked Sep 19 by xiaoxi (12 points)
I want to use the mouse to click on the UI, but there will be a problem with the offset, causing the mouse to not interact properly.

1 Answer

0 votes
answered Sep 19 by AlexShorey (259 points)

Hi Xiaoxi,

The problem you're encountering is the result of lacking a proper Event Camera assigned to your UI's Canvas component. It's a little tricky to make one, so see the link below for a monobehaviour script that can replicate zCore's internal cameras. You'll have to modify it slightly. Instead of replicating ZCore.Eye.Left and Right, you should change it to Center. When the script generates the camera on start-up, assign it to your canvas' public property, Event Camera . This should solve your problem, but let me know if you have any troubles with it.

Alex S.

commented Sep 19 by xiaoxi (12 points)
edited Sep 19 by xiaoxi
Thank you very much for your answer