Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Do I have to define my own draw method?

A topic by phantasmol_2516 created 90 days ago Views: 58 Replies: 3
Viewing posts 1 to 3
(1 edit)

Here is the error message:

___________________________________________

############################################################################################

ERROR in

action number 1

of Draw Event

for object obj_GGL_controller:

Variable <unknown_object>.Draw(100230, -2147483648) not set before reading it.

 at gml_Object_obj_GGL_controller_Draw_64 (line 32) -                                    _inst.Draw();

############################################################################################

gml_Object_obj_GGL_controller_Draw_64 (line 32)

...

============================================================================================

============================================================================================

and of course the code:

#region draw_all_the_gui_elements

/*

we set the surface, draw all of the parent_GGL objects in order and reset the surface.

*/

gpu_set_blendmode_ext(bm_one, bm_inv_src_alpha);

shader_set(shd_GGL_premult);

surface_set_target(surf);

draw_clear_alpha(0, 0);

var _layer, _count, _inst;

for (var i = ds_map_find_last(ds_map_layers); !is_undefined(i); i = ds_map_find_previous(ds_map_layers, i)){

_layer = ds_map_layers[? i];

_count = ds_grid_height(_layer);

for (var j = 0; j < _count; ++j) {

    _inst = _layer[# e_GUI_depth_parameter.id, j];

if(instance_exists(_inst)){

_inst.Draw();                                 <=== !!!

if(_inst.debug){

_inst.Draw_debug();

}

}

}

}

surface_reset_target();

shader_reset();

gpu_set_blendmode(bm_normal);

#endregion

============================================================================================

============================================================================================

I looked around in the code but did not see a Draw method defined anywhere, do I need to do this myself?

I fixed it: 

if(instance_exists(_inst) && variable_instance_exists(_inst, "Draw")){         <=== modified

_inst.Draw();

if(_inst.debug){

_inst.Draw_debug();

}

}

Thanks a million. Had the same issue while following the menu tutorial.

Developer

Hi, you were faster than me ^^

I'll have a look and update the packages accordingly, 

thanks for the bug report :)