• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Does destroying a ds_list also destroy its objects which are in it?

Hey guys!
I got a minigame that generate objects (1 or 2 objects every x sec), so I need to destroy all of them. Since this minigame takes little time (less than 5 sec), I thought about destroying the objects when the minigame is over and not when the object in question leaves the visible area of the minigame.
So I got this idea : I put all of the generated object (their instance) in a ds_list. At the destroy event of my minigame, I destroy all of the objects in my ds_list and the ds_list itself. Si I got a question does destroying a ds_list also destroy its objects which are in it? Because I'm not going to destroy all of the instances before destroying my ds_list if the ds_list_destroy do it for me
Thanks!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
No, it doesn't. All you are storing in the DS list are references (instance IDs) to the instances of the objects... You will need to loop through the list and destroy all the instances first then destroy the list.


PS: There is a difference between objects and instances... objects are the "blueprints" in the asset browser, while instances are the actual things that you make from objects in the game... Not trying to be pendantic or anything, I just feel it's an important distinction and using the correct terms will prevent misunderstandings on the forum. ;)
 
No, it doesn't. All you are storing in the DS list are references (instance IDs) to the instances of the objects... You will need to loop through the list and destroy all the instances first then destroy the list.


PS: There is a difference between objects and instances... objects are the "blueprints" in the asset browser, while instances are the actual things that you make from objects in the game... Not trying to be pendantic or anything, I just feel it's an important distinction and using the correct terms will prevent misunderstandings on the forum. ;)
Okay thanks I will do that
PS : Yup sorry I understand the distinction but I use it little when I speak, it often plays tricks on me elsewhere :confused:
 
Top