Heya,
It is about the panel_load_menu.
All three panels are children of a Canvas.
During the For…Next it is found and assigned.
It is also set to SetActive(false) without any problem and I can with a button set it active and false.
But the compiler keeps telling me I have a nullreference error to an object that is not null?
I can compile the code, start playmode and even Build and Run and turn the panel On and Off,
yet even in debug mode of the build I get the error message
Why?
GameObject[] child = new TargetChildObjects("canvas_main_menu(Clone)").targetchildobjectsArray;
for(int i = 0; i < child.Length; i++)
{
if (child[i].name == "panel_main_menu") { panel_main_menu = child[i]; }
if (child[i].name == "panel_load_menu") { panel_load_menu = child[i]; }
if (child[i].name == "panel_newplayer_menu") { panel_newplayer_menu = child[i]; }
}
panel_load_menu.gameObject.SetActive(false); //<= Error points to this line
panel_newplayer_menu.gameObject.SetActive(false);// <= Why not to this one.
ps: my first code was just 'panel_load_menu.SetActive(false) ’ but it gave me the same error