Pointer still interacts with UI canvas after ignore tag is added to it with script
See original GitHub issueI have a Canvas object in my scene and when I click a button on the controller, a script adds a “IgnorePointer” tag to the canvas and disables the renderer. The code is pretty simple:
GameObject UI = GameObject.Find("UI Canvas");
UI.tag = "IgnorePointer";
GameObject conceptMenu = GameObject.Find("UI Canvas");
Canvas conceptCanvas = conceptMenu.GetComponent<Canvas>();
conceptCanvas.enabled = false;
When the button is clicked, the canvas disappears and the tag is correctly added, but if you activate the pointer and aim it where the canvas was, the ray-cast still collides with the invisible canvas. Is this a bug or am I going about this operation incorrectly?
Edit: I should clarify that if you manually add the tag in the editor instead of from script, that the ray-cast performs as expected and passes through the canvas.
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (10 by maintainers)
Top Results From Across the Web
Ignore Mouse/Pointer Interaction on UI Image
I added a Canvas Group component to the logo and unchecked "Blocks Raycasts". I also unchecked "Intractable" (I don't know if this was...
Read more >How to fix the rendering of laser with respect to the UI canvas
There is an issue with the occlusion of UI elements with respect to the laser pointer. The pointer here is made from a...
Read more >Manual: Pointer events
Pointer events always precede mouse events in UI Toolkit. Pointer events don't have a persistent position. They also don't have a set position...
Read more >Pointer events - Web APIs | MDN
Pointer events. Much of today's web content assumes the user's pointing device will be a mouse. However, since many devices support other types ......
Read more >Create an easy, reliable, and clean UI in Unity
After adding a Canvas game object to your scene, some game components will be attached to it automatically, including a Canvas component.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No it’s a bug 😃
Don’t worry I’m implementing the fix right now 😃