- Home /
Problem when set active off/on UI element
Hi guys
Before go in game scene the canvas button work fine, but when set active off a canvas child element (and active an fps camera) and re-switch on (after the game experience is ended) this is visible but impossible clicked with mouse, it's work only manually in the inspector flag "IS ON". The mouse click on button , but the cursor is hide every click.
Any suggestion?
Thank you
setting active/inactive cant be the issue, chekc if the raycastarget is set to true, and make sure there is nothing in front like a panel blocking the raycasts, try adding an event trigger and check if those events are getting fired
Answer by KaspianR · Oct 10, 2019 at 09:41 AM
Have you made sure to enable the mouse again after disabling it for the First Person Controller? If not, run the following code along with activating the UI element!
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
That will make the cursor visible and movable hopefully making you able to click the button. Please let me know if this works and good luck with your project!
Your answer
Follow this Question
Related Questions
UI button on Canvas Space World not working on Android 0 Answers
UI elements are not getting affected by lighting 0 Answers
Particle System not showing over "Screen Space - Overlay" UI Canvas 0 Answers
My UI buttons work fine in editor but when I exported the game on Android, only some of them works. 0 Answers
How do Pointer events work? 4.6 UI 1 Answer