LanguageSource Inspector Assets auto destroy

More
6 years 5 months ago #3035 by yuewah
In v2.8.6 f2, If LanguageSource.Assets is added during runtime, when select the Assets Tab in inspector, the object will auto destroy one by one until empty.

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #3036 by yuewah
I find that it is because LanguageSource.Assets is added by loading asset in Resources folder.
However, In LocalizationEditor.cs
GUITools.DrawObjectsArray( mProp_Assets, false, false, false, testAddObj, testReplaceObj, testReplaceIndx, testDeleteIndx);

Since allowResources is false, so it will auto destroy.

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago - 6 years 5 months ago #3041 by Frank
Hi,
The problem is that LanguageSource.Assets shouldn't contain any asset from Resources.
The idea of that array is that it includes references to those assets that the plugin can't load at runtime because they are not in the Resources folder.
If you need to add assets (sprites, fonts, etc) from the resources folder, just add the path+name to the translation.

For example:
Term: "MY_FONT", English: "Arial", Spanish:"CustomFonts/Comic"

That will automatically load the Arial font from "Resources/Arial" when in English, and the "Resources/CustomFonts/Comic" when in spanish.
However, if "Arial" is not found in a Resources folder, then the plugin will look for it in the Assets array.

More details here: inter-illusion.com/assets/I2LocalizationManual/AssetsTab.html

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Last edit: 6 years 5 months ago by Frank.

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #3042 by yuewah
But I would like to preload all font and material assets during app startup. I tried I2.Loc.ResourceManager, but it doesn't have Addsset( Object Obj ) like LanguageSource

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #3043 by Frank
You can do:
ResourceManager.pInstance.GetAsset<Font>("Custom Fonts/Comic");

That will load the font if it's not already loaded and save it into the mResourcesCache dictionary so that any time the plugin needs to request that font, it will get it from there.

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #3045 by yuewah
we need to load all font assets in resources folders, however, there are no method to get all font assets name in the resources folder.

Please Log in or Create an account to join the conversation.

Time to create page: 0.142 seconds
Template by JoomlaShine