object_exists

Returns whether an object with the given index exists or not.

Syntax:

object_exists(obj);


Argument Description
obj The index of the object to check.


Returns: Boolean


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.


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.


Back: Objects
Next: object_get_depth
© Copyright YoYo Games Ltd. 2018 All Rights Reserved