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:
Answer by commodore · Dec 17, 2015 at 11:37 PM
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.
Your answer
Follow this Question
Related Questions
Get a selected item from a GameObject list? 0 Answers
How to enable script on another gameobject in C#? 1 Answer
Why does GameObject.Find() work in ones and not in others? 1 Answer
What range of values need to be inserted if we need to pull a random item from the list? 0 Answers
How can I destroy a Gameobject from a list at a specific index 1 Answer