can't enable disabled obects in a list

how to enable/access disabled GameObject object in a list unity.

Hi, i have a GameObject named UI which i have put in a list by dragging it in the inspector and i want it to b disabled if we are in the menu scene and enabled if we are in the game scene but when i do so it gives an error: NullReferenceException or Unity Stucks and dosen’t respond
any kinf of help is appreciated.
it will be very nice of you to also include an example thnxs:

Try naming your GameObject something other than UI. It could be interfering with the UnityEngine.UI namespace.

You should be able to just do ui.SetActive(true); to enable it and ui.SetActive(false); to disable it.