
asset_get_type
Description
With this function you can get the type of asset being referenced from its name (a string). One of the constants listed below will be returned.
Syntax:
asset_get_type(name);
| Argument | Description |
|---|---|
| name | The name of the game asset to get the type of (a string). |
Returns:
Constant
| 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_tile | The given name refers to a tile set. |
| 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_shader | The given name refers to a shader. |
| asset_unknown | The given name refers to an asset that either does not exist, or is not one of the above listed. |
Example:
|
|
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.
这个函数是根据asset的名字,来获取它的类别,返回的类型为系统提供的常量,简单易懂。




近期评论