question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pointer still interacts with UI canvas after ignore tag is added to it with script

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
thestonefoxcommented, Oct 21, 2016

No it’s a bug 😃

1reaction
thestonefoxcommented, Oct 21, 2016

Don’t worry I’m implementing the fix right now 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found