object_get_name

Returns the name of the specified object as defined in the resource tree.

Syntax:

object_get_name(obj);


Argument Description
obj The index of the object to check.


Returns: String


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().


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".


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