Heya, something I’ve been bitten by a few times and was wondering if it’s possible to see a feature crop up out of. Very simple, right now as far as I can tell, you can only set picking mode via UXML or code. The problem? You end up with code like this:
In my case, I’m creating all of these elements dynamically via code. The only way to set the picking mode is this very clunky piece-by-piece mannor which also requires me to go into the debugger for every element and figure out which unity things have picking enabled and find some way to reference them and blah blah. Very tedious!
Styles would already serve as a mechanism to fix this, but it’s not actually something you can do right now. Not sure if this would be a simple thing or not, but it would serve to alleviate some headache for many I think.
It’s something that is definitely on our radar. Css has pointer-events: none, which is also inherited so its behavior is more in line with that you’re trying to achieve.
Based on the CSS docs it sounds like exactly like what I’m looking for, set the elements click events to be ignored but still fall through to underlying elements.
For the love of god, please add pointer-events. The current behavior with uxml picking-mode is absolutely stupid - it works on only one element and one element only. It means that if you want to have an element not be clickable you need to also set all its children to picking-mode=False.
I do not understand why that is the default behavior. In my 5 years of webdev never have I needed to disable clicks on just one specific element.
I think it makes sense to have the option between “no pointer events for this element” and “no pointer events for this element and all its desendants”.
However, the later (with desendants) could be achieved using the first (only this element) and a USS rule that applies it to all desendants.
Only thing needed really is to expose -unity-picking-mode in USS
Been using UI toolkit for a bit, am sad picking mode isn’t customizable. When it comes to UI it should be easy customizable what the player can and cannot interact with…
While at it:
add proper tooltips when hovering over an properties in UI builder explaining what the property does. “USS property” and “value definition” doesn’t explain anything what it does
rename picking mode to something more understandable, took me a while to understand it works the same way Raycast target does. Plus the docs are very bad at explaining what it does: “Describes the picking behavior.”