Make sure that you have installed Addressables and open window Addressables Groups:
Window > Asset Management > Addressables > Groups
If you are seeing this window first time you should see a button named “Create Addressables Settings”. Click it.
Then import all files into your project.
After the import process completition you should see a bunch of new groups in window Addressables Groups prefixed with “DA -”.
Done! You are all set.
NOTE: If you encounter an exception UnityEngine.AddressableAssets.InvalidKeyException in example scenes, there is a problem, that Unity can’t find imported Addressables. In this case try to build newly imported addressable groups from window Addressables Groups > Build > New Build
Country Group #
NOTE: Before you continue, you should read the documentation about Scriptable Items & Groups
CountryGroup is a derived class from class ScriptableItem with a Reorderable List of classes Country.
Each Country has a Name, ISO Code, ISO Code (3), Capital City & Dialing Code.
You are free to create custom Country Groups:
Project Window (Right Click) > Create > Dragon Arts > Collection > Country Group
There is also a button SYNCHRONIZE, which overwrites attributes based on ISO Code or ISO Code (3), so in case of custom Country Groups there is not needed to manually fill each field. Data are loaded from the Master Country Group:
NOTE: Do not update Master Country Group manually.
There are 2 options to get Country Flags into your project. First is by using configured TextMeshPro Sprite Asset straight in texts, e.g.:
The second option is load them through address through Country class methods:
using DragonArts.Collection.Countries; // NOTE: Do not forget to import namespace // ... Country country = countries.list; Sprite flag = await country.LoadFlag(); // ...
There is also a static method:
Sprite flag = await Country.LoadFlag("SVK");
Do not forget to release loaded flags after that you don’t need them anymore:
In case of static method, you have to handle releasing by yourself.
As a bonus the Country Collection contains Anthems, which you can load similarly as you can load Flags:
// ... Country country = countries.list; AudioClip anthem = await country.LoadAnthem(); // ...