object_exists


Description

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.


Syntax:

object_exists(obj);

Argument Description
obj The index of the object to check.


Returns:

Boolean


Example:

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.