asset_get

Returns the unique index (real) for any built-in game asset – including sounds, objects, and sprites. Can be used, for example, to assign a specific sound effect to a character attack.

To get the index of a custom (loaded with your character) asset, use

sprite_get( sprite )  Reference→
sound_get( sound )  Reference→

functions instead.

ArgumentTypeDescription
asset:stringThe name of the game asset to get the index of

Example, called from bair.gml:

// sets the sound effect assigned to the 3rd bair window:
set_window_value( AT_BAIR, 3, AG_WINDOW_SFX, asset_get( "sfx_swipe_medium1" ));