Hi,
Something I've been struggling with is how to go from one UI window to another. As an example, the main menu to the options menu.
As far as I can tell, we have every different UI window as a different object - so I'm spawning the new UI object (w/ instance_create) when I need to jump to another window, and then trying to destroy the object for the previous UI.
When I try to use instance_destroy() in the UI I want to close, it often causes an error like (below I was trying to open a new UI and close the current one):
ERROR in action number 1
of Step Event0 for object obj_autoGUIMenu_parent: not an instance
at gml_Script_editLib@gml_Object_obj_DayResults_Create_0 (line 38) -
instance_destroy();
############################################################################################
gml_Script_editLib@gml_Object_obj_DayResults_Create_0 (line 38)
gml_Script_anon@211@gml_Object_obj_DayResults_Create_0 (line 9) - global.options[0].set_click_func(function() { editLib(); });
gml_Script_zz_private_check_if_hovering@anon@17422@AutoUiElement@AutoUiElement (line 426)
gml_Script_step@anon@7389@AutoUiButton@AutoUiButton (line 179) - zz_private_check_if_hovering();
gml_Script_step@anon@13630@AutoUiFlexContainer@AutoUiFlexContainer (line 386) - _item.step(_xx,_yy);
gml_Script_step@anon@13630@AutoUiFlexContainer@AutoUiFlexContainer (line 384) - _item.step(__xx,__yy);
gml_Object_obj_autoGUIMenu_parent_Step_0 (line 1) - flex.step(display_get_gui_width()/2, display_get_gui_height()/2);
gml_Object_obj_DayResults_Step_0 (line 2)
So, I guess this is not the correct way to do it. What is the best way to 'shut down' a UI? Do I need to destroy the containers first?
I tried having instance_destroy() on a timer for 1 tick but that made no difference either. Instead, I've been adding code to the 'next' UI to close the previous one, but it's a bit messy so I'm hoping there's a cleaner way to do it?
Thanks for your help!
Jeff.
