uGUI automatic navigation with buttons that are instatiated

Hey there!

OK so I’m having a bit of trouble with buttons that are spawned in at runtime.

they are spawned in to rows that have a CanvasGroup parent that may or may not be interactible at the time (its a set of toggles (tabs) that show/hide the buttons depending on which tab is selected).

The problem is that when one tab is hidden and one isnt, the automatic navigation will select a hidden button in the background that shouldnt be accessible unless the relevant tab is active.

I’ve tried setting all the buttons to interactible=false when the relevant tab is unselected, but that doesn’t seem to help.

I would manually hook up the navigation but since the buttons are instantiated at runtime this is not possible.

Any ideas or avenues of investigation would be much appreciated!

Try setting the parent object to inactive with gameObject.SetActive(false) and see if it works.