asset_get_type(name);
Argument | Description |
---|---|
name | The name of the game asset to get the type of (a string). |
Returns: Constant
With this function you can get the type of asset being referenced from it
s name (a string). The following constants are returned:
Constant | Description |
---|---|
asset_object | The given name refers to an object. |
asset_sprite | The given name refers to a sprite. |
asset_sound | The given name refers to a sound. |
asset_room | The given name refers to a room. |
asset_background | The given name refers to a background. |
asset_path | The given name refers to a path. |
asset_script | The given name refers to a script. |
asset_font | The given name refers to a font. |
asset_timeline | The given name refers to a time line. |
asset_unknown | The given name refers to an asset that either does not exist, or is not one of the above listed. |
if asset_get_type("pth_Path_" + string(global.Game)) == asset_unknown
{
show_debug_message("Path doesn't exist!!!");
}
else
{
path_index = asset_get_index("pth_Path_" + string(global.Game));
}
The above code checks a dynamically created asset name to see if the asset is of the correct type. If it is not, then a debug message will be shown, otherwise the asset name is used to assign the asset to the instance.