Windows How To Destroy Previous Object If I Have The Second One

I want to know how to destroy previous object if I have the second one. I've tried to do it using instance_id but nothing didn't work. Say in advance, thanks everyone for help :3
 
If you mean having a singleton, you can just check if more than one exists with instance_number(), and act accordingly (i.e destroy the duplicates or create an instance if none exists) according to that.
 

Roldy

Member
I want to know how to destroy previous object if I have the second one. I've tried to do it using instance_id but nothing didn't work. Say in advance, thanks everyone for help :3
I think you will need to be more clear about what you are asking. Give an example of what you are trying to do.
 
I create a new object with button and if I have more than 1 of these instances I need to destroy the previous object (first created)
 
Top