This function returns whether an object with the specified index exists or not. Note that this checks to see if an object is present in the resource tree, and not actually in the game room. For that you should use the function instance_exists.
object_exists(obj);
Argument | Description |
---|---|
obj | The index of the object to check. |
Boolean
if object_exists(obj_temp)
{
with (obj_Temp) scr_add_event();
}
The above code checks the variable "obj_temp" to make sure that it stores the index of an object and then, if it does, it makes the object run a script.