object_index


Description

This read only variable returns the index of the object that the instance has been created from. This is not the same as the object name, which is a string and can be found using object_get_name, as this function returns the index number, which is a unique value that GameMaker Studio 2 assigns to every object at the time of creation.


Syntax:

object_index;


Returns:

Object Index Value (Real)


Example:

obj_name = object_get_name(object_index);

The above code will use the object_index to find the name of the object that the current instance has been created from.