object_get_name


Description

This function will return the name as a string of the specified object. This name is the one that has been specified for the object in the resource tree of the main GameMaker Studio 2 window. Please note that this is only a string and cannot be used to reference the object directly - for that you would need the object index. You can, however, use this string to get the object index using the returned string along with the function asset_get_index().


Syntax:

object_get_name(obj);

Argument Description
obj The index of the object to check.


Returns:

String


Example:

str = object_get_name(object_index);

The above code will get the name of the object index for the instance running the code and store the return value in the variable "str".