CreateCollection(string, string)
Creates a table collection with one table for each available locale.
Read time 1 minuteLast updated 6 hours ago
Definition
- Type: Method
- Namespace: Unity.Localization.Editor
- Assembly: UnityEditor
public static ResourceTableCollection CreateCollection(string parentFolder, string collectionName)
Parameters
Returns
Type | Description |
|---|---|
| ResourceTableCollection | The new ResourceTableCollection, or |
Remarks
Creates a folder named inside that holds the ResourceTableCollection asset, its SharedTableData asset, and a ResourceTable asset for each locale in the LocalizationSettings.AvailableLocales of LocalizationEditorSettings.ActiveSettings. A numeric suffix is added to any name that is already taken, so read the name back from the returned collection. A collection inside a Resources folder uses the Resources content source; otherwise it uses the content source that the Project Settings choose. The collection is registered with that source and saved. The call does nothing and returns when the project has no LocalizationEditorSettings.ActiveSettings or those settings have no locale.
collectionNameparentFoldernullAdditional Resources: LocalizationEditorSettings.ActiveSettings, LocalizationEditorSettings.AddTable, LocalizationEditorSettings.CreateStringEntry
Creates a collection in the Assets/Localization folder and adds a key to it.
Examples
using Unity.Localization.Editor;using UnityEditor;namespace Unity.Localization.Samples{ public class CreateCollectionExample { public void Run() { if (!AssetDatabase.IsValidFolder("Assets/Localization")) AssetDatabase.CreateFolder("Assets", "Localization"); var collection = LocalizationEditorSettings.CreateCollection("Assets/Localization", "Menu"); if (collection == null) return; LocalizationEditorSettings.CreateStringEntry(collection, "Play"); } }}