object_index


描述

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.


语法:

object_index;


返回:

Object Index Value (Real)


例如:

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.