S
sefi331
Guest
Hi all,
So my problem is that I am using asset_get_index to draw a sprite that saved in a global variable that loaded form an .ini file:
the load action in the .ini file:
global.sprite_player_p1 = ini_read_string("p1_player_pic","p1_pic","s_chal_t_avatar_p1");
the sprite - 's_chal_t_avatar_p1' exists off course, and I refer to it as a string because I notice that if I set sprite to variables it get mushed up and weird when I add new sprites and then the variables get a new index and object is drawing a wrong sprite.
the draw action (draw gui that contain a script):
draw_sprite_ext(asset_get_index(global.sprite_player_p1),0, x_draw, y_draw,
xScale* 0.3 * facing, yScale * 0.3 , 0, color, alpha);
Works perfectly when checking in windows, however, when I export a build and try it on android I get the error:
ERROR in
action number 1
of Draw Event
for object (the object that run the script in its draw gui event)
Trying to draw non-existing sprite.
at gml_Script_(the script that contain the above code)
stack frame is
gml_Script_(the script that contain the above code) (line -1)
gml_Object_(the object that run the script in its draw gui event)_Draw_64
What is the reason for that? I that a problem with asset_get_index on android?
When I checked a previous version apk I see that the draw_sprite_ext contain the global variable without asset_get_index and it works without error.
Thanks!
So my problem is that I am using asset_get_index to draw a sprite that saved in a global variable that loaded form an .ini file:
the load action in the .ini file:
global.sprite_player_p1 = ini_read_string("p1_player_pic","p1_pic","s_chal_t_avatar_p1");
the sprite - 's_chal_t_avatar_p1' exists off course, and I refer to it as a string because I notice that if I set sprite to variables it get mushed up and weird when I add new sprites and then the variables get a new index and object is drawing a wrong sprite.
the draw action (draw gui that contain a script):
draw_sprite_ext(asset_get_index(global.sprite_player_p1),0, x_draw, y_draw,
xScale* 0.3 * facing, yScale * 0.3 , 0, color, alpha);
Works perfectly when checking in windows, however, when I export a build and try it on android I get the error:
ERROR in
action number 1
of Draw Event
for object (the object that run the script in its draw gui event)
Trying to draw non-existing sprite.
at gml_Script_(the script that contain the above code)
stack frame is
gml_Script_(the script that contain the above code) (line -1)
gml_Object_(the object that run the script in its draw gui event)_Draw_64
What is the reason for that? I that a problem with asset_get_index on android?
When I checked a previous version apk I see that the draw_sprite_ext contain the global variable without asset_get_index and it works without error.
Thanks!