Resource get

You can use this function to get the unique identifying index for any custom or built-in asset (sprite, sound, or object). The function will check custom sprites, custom sounds, and built-in assets in that order. It returns the index of the first match it finds. If the asset is not found, the function will return a value of -1 instead.

Syntax
resource_get( asset );

Returns
real (asset index)

Basic
// init.gml // stores indexes for the custom sprite "my_sprite_strip#.png", the custom sound "my_sound.ogg", and the built-in sfx "sfx_swipe_medium1" spr_my_sprite = resource_get( "my_sprite" ); sfx_my_sound = resource_get( "my_sound" ); sfx_built_in_swipe = resource_get( "sfx_swipe_medium1" ) );