I am pulling my hair out trying to figure out why my button is visible (Hit testable)
I have no calls in animation to visibility.
I have it set by default to non hit testable (SelfOnly).
I wouldn’t attempt this onInitalised, can you do it after EventConstruct instead? Doubt the button is ready before that. What’s happening is probably Construct overriding whatever you’re trying to set up earlier. Also, no reason for DoOnce - Init runs only once - that’s the point.
Some things work great onInitalised - like Event Dispatcher binding since this has nothing to do with laying out widgets.
No additional Init / Construct script is needed here. It’s this, most likely:
The button cannot be hit directly, sure, but the text is probably set to Visible, and it will actually bubble up in the hierarchy and hit the button - buttons are evil like that.
either set the Button to NH-T (Self and All Children)
or set the nested element (text) to NH-T (Self), too
I had already thought about this already but I have had cases where the button text occluded the button and wouldn’t let you click on it unless you had the text child set to visible. So I treated it like a no go zone/proper child behaviour.