sprite_get_name


Syntax:

sprite_get_name(index);

Argument Description
index The index of the sprite to get the name of.


Returns

String


Description

This function will return the name as a string of the specified sprite. This name is the one that has been specified for the sprite 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 sprite directly - for that you would need the sprite index. You can, however, use this string to get the sprite index using the returned string along with the function asset_get_index().


Example:

str = sprite_get_name(sprite_index);

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