GML [solved] Is there difference between "with" and "instance_destroy"?

hdarren

Member
Because of my past usage of previous version of GameMaker if I want to destroy objects I'm so used to using code like this:

Code:
with object {instance_destroy();}
But in recent version of GameMaker they added extra arguments to the instance_destroy() function. Is there a difference between the following two lines of code?

Code:
with object {instance_destroy();}
instance_destroy(object);
 

FrostyCat

Redemption Seeker
There is a difference only if you work with legacy code.

The form not using with is only accepted on GMS 2 and the last few versions of GMS 1. The form using with is accepted on all known versions of GM, starting with legacy 1.0 from almost two decades ago.
 
Last edited:

samspade

Member
I didn't realize that instance_destroy functioned like with instead of the dot accessory - i.e. won't throw an error if you supply an id of an instance that doesn't exist and will loop through all objects if you supply an object id. But that manual does say this, so its my fault for never reading it carefully.
 
Top