i18n_get_asset_from_ref()
The i18n_get_asset_from_ref()
function is used to get the asset from the reference you created using the i18n_create_ref_asset()
function.
This function can only be used after the i18n_create()
function is called.
Syntax
Usage
i18n_get_asset_from_ref(var_name, ref, [locale], [i18n]);
Parameters
Name | Type | Default | Description |
---|---|---|---|
var_name | String | Variable name based on the var_name parameter used in i18n_create_ref_asset() function (e.g. global.my_obj.my_spr , my_obj.my_spr , my_arr.0 , my_struct.my_spr , etc.). | |
ref | String | Instance | Object | Reference name or instance id based on the ref in i18n_create_ref_asset() function. Recommended to pass "global" if the reference is created in global variable, or instance id if the reference is created in an instance. | |
locale | String | "" | The locale code to get the asset from. Leave it empty to get the asset from the current locale. |
i18n | Boolean | I18n | false | The i18n struct reference, or leave it empty to use the global i18n struct. |
Returns
Asset
Examples
Create Event
// assume the system is initialized on global variable
// create some asset references
my_spr = i18n_create_ref_asset("my_spr", {
en: sprSplashEn,
id: sprSplashId,
ja: sprSplashJa
});
my_arr = [
i18n_create_ref_asset("my_arr.0", {
en: sndVoiceEn,
id: sndVoiceId,
ja: sndVoiceJa
})
];
global.my_obj = i18n_create_ref_asset("global.my_obj", {
en: objPlayerEn,
id: objPlayerId,
ja: objPlayerJa
});
global.my_font = {
my_font_1 : i18n_create_ref_asset("g.my_font.my_font_1", {
en: fnNotoSansEn,
id: fnNotoSansId,
ja: fnNotoSansJa
}),
ui_font : [
i18n_create_ref_asset("global.my_font.ui_font.0", {
en: fnNotoSansEn,
id: fnNotoSansId,
ja: fnNotoSansJa
})
]
};
// see the function usage in the Key Pressed - Enter
Table of Contents