Check if Variable equals existing instance id without error if it doesn't

If I set a variable to an instance id, what do I do to check later if the instance id contained in the variable exists, to avoid it throwing an error when I try to do something to the instance later, if the instance id value in the variable doesn't exist because it was destroyed. Keep in mind I'm checking with a variable name, so it also needs to not throw errors if it doesn't equal any instance id. Does what I initialize the variable as make a difference?
 

RangerX

Member
Catch the instance of that object in a variable so you can access that instance's variables easily later. However, the only way to be 100% sure that instance still exist before changing one of its variables is to use "instance_exist".
If you have multiple instances of that object and you want to spot a specific one, you need to cycle through them with a "with" loop.
 
Top