Zuljaras
Member
I decided to make a new thread since the other one is not about his issue.
So my pause menu (inventory etc.) is in another separate room (not persistent).
When I am in the game and decide to go there I press my "A" key I set my current room persistent = true and them I go to my pause menu.
After going back I set the persistent = false.
So far so good!!! It runs perfectly in GMS 1.4.
However in GMS 2 every time I do that I get memory piling up! if I do not make the current room persistent there is no memory leak!
Is there something I am missing?!
Here is the control object that handles the whole thing:
I personally think this is bug in GMS 2.
So my pause menu (inventory etc.) is in another separate room (not persistent).
When I am in the game and decide to go there I press my "A" key I set my current room persistent = true and them I go to my pause menu.
After going back I set the persistent = false.
So far so good!!! It runs perfectly in GMS 1.4.
However in GMS 2 every time I do that I get memory piling up! if I do not make the current room persistent there is no memory leak!
Is there something I am missing?!
Here is the control object that handles the whole thing:
Code:
Information about object: controlobjectpausemenu
Sprite:
Solid: false
Visible: false
Depth: 0
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:
global.lastroom=1;
canpress=true;
Alarm Event for alarm 0:
execute code:
audio_pause_all();
room_goto(pausemenu);
canpress=true;
Alarm Event for alarm 1:
execute code:
audio_pause_all();
room_goto(shop_room);
canpress=true;
Alarm Event for alarm 2:
execute code:
audio_pause_all();
room_goto(map_room);
canpress=true;
Step Event:
execute code:
if instance_number(object_index)>1 instance_destroy()
if room!=pausemenu && room!=shop_room && room!=map_room
{
if (keyboard_check_pressed(global.KeyDefault[3]) || gamepad_button_check_pressed(global.gp,gp_padu) || gamepad_axis_value(global.gp,gp_axislv)<0)
{
if instance_exists(player_parent_obj)
{
if global.canshop=true && (playero.sprite_index=playersleft or playero.sprite_index=playersright)
{
if global.paused=false && canpress=true
{
if instance_exists(weapon_parent)
{weapon_parent.persistent=false;}
player_parent_obj.persistent=false;
new_resolution.persistent = false;
global.lastroom=room;
room_persistent=true;
canpress=false;
alarm[1]=5;
}
}
}
}
if (keyboard_check_pressed(global.KeyDefault[6]) || gamepad_button_check_pressed(global.gp,gp_start))
{if instance_exists(player_parent_obj)
{
if global.paused=false && canpress=true
{
global.lastroom = room;
player_parent_obj.persistent = false;
new_resolution.persistent = false;
room_persistent = true;
if instance_exists(weapon_parent)
{weapon_parent.persistent = false;}
canpress=false;
alarm[0]=5;
}
}
}
/*
if os_is_paused()
{
if instance_exists(player_parent_obj)
{
if global.paused=false && canpress=true
{
if instance_exists(weapon_parent)
{weapon_parent.persistent=false;}
player_parent_obj.persistent=false;
global.lastroom=room;
room_persistent=true;
canpress=false;
alarm[0]=5;
}
}
}
*/
if (keyboard_check_pressed(global.KeyDefault[10]) || gamepad_button_check_pressed(global.gp,gp_select))
{if instance_exists(player_parent_obj)
{
if global.paused=false && canpress=true
{
if instance_exists(weapon_parent)
{weapon_parent.persistent=false;}
player_parent_obj.persistent=false;
global.lastroom=room;
room_persistent=true;
canpress=false;
alarm[2]=5;
}
}
}
}
Other Event: Room Start:
execute code:
if room!=pausemenu && room!=shop_room && room!=map_room
{
player_parent_obj.persistent = true;
new_resolution.persistent = true;
if instance_exists(weapon_parent)
{weapon_parent.persistent=true}
room_persistent=false;
}