GMS 2 Question about rooms

U

User

Guest
In every room we can write a RoomCreationCode, create objects from code, place objects etc.
Room is not persistent, and object is not persistent or global (like variable).

Do we need to delete these objects, variables?

RoomCreationCode (room is not persistent)
Code:
//Camera create
view_camera[0] = camera_create_view(display_width_left, display_height_top, display_width,display_height, 0, 0, 0, 0, 0, 0);
view_set_xport(0, 0);
view_set_yport(0, 0);
view_set_wport(0, display_width);
view_set_hport(0, display_height);
view_visible[0] = true;
view_enabled = true;

//Local var create and set
var1=0;

//Global var create and set
global.var2=0;

//Go next room
room_goto_next();
We create camera, local variable, global variable.
And go to next room. So now we have only global variable. Camera and local variable was deleted.
And we do not need to delete them manually.
I'm right?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
The camera needs deleted before you go to the next room, but the variables do not. You only need to clean up any dynamic resources that you have made in code, so things like cameras, data structures, particles, etc... basically anything that has "create" or "add" in the function name will have a corresponding "destroy" or "delete" function which should be called when that resource is no longer required.
 
Top