public void EntryIdIsResolvedFromName() { TableReference tableReference = kStringTableNameGuid; TableEntryReference tableEntryReference = kStringKeyName; Assert.AreEqual("TableEntryReference(123 - My Entry)", tableEntryReference.ToString(tableReference)); }
/// <summary> /// Remove the asset mapping from the table entry and also cleans up the Addressables if necessary. /// </summary> /// <param name="table"></param> /// <param name="entryReference"></param> /// <param name="createUndo"></param> public void RemoveAssetFromTable(AssetTable table, TableEntryReference entryReference, bool createUndo = false) { using (new UndoScope("Remove asset from table", createUndo)) { // Clear the asset but keep the key var tableEntry = table.GetEntryFromReference(entryReference); if (tableEntry == null) { return; } var removedAssetGuid = tableEntry.Guid; tableEntry.Guid = string.Empty; var aaSettings = LocalizationEditorSettings.Instance.GetAddressableAssetSettings(false); if (aaSettings == null) { return; } EditorUtility.SetDirty(table); EditorUtility.SetDirty(table.SharedData); RemoveEntryAssetType(tableEntry.KeyId, table.LocaleIdentifier.Code); // If the entry has metadata then we will leave an empty entry otherwise we just remove the whole thing. if (tableEntry.MetadataEntries.Count == 0) { table.RemoveEntry(tableEntry.KeyId); } // Determine if the asset is being referenced by any entries or tables with the same locale, if not then we can // remove the locale label and if no other labels exist also remove the asset from the Addressables system. var assetTableCollections = LocalizationEditorSettings.GetAssetTableCollections(); foreach (var collection in assetTableCollections) { if (collection.GetTable(table.LocaleIdentifier) is AssetTable tableWithMatchingLocaleId && tableWithMatchingLocaleId.ContainsValue(removedAssetGuid)) { // The asset is referenced elsewhere by a table with the same Locale so we can not remove the locale label or asset. return; } } // Remove the locale label for this asset var assetEntry = aaSettings.FindAssetEntry(removedAssetGuid); if (assetEntry != null) { if (createUndo) { Undo.RecordObject(assetEntry.parentGroup, "Remove asset from table"); } var assetLabel = AddressHelper.FormatAssetLabel(table.LocaleIdentifier); assetEntry.SetLabel(assetLabel, false); UpdateAssetGroup(aaSettings, assetEntry, createUndo); } LocalizationEditorSettings.EditorEvents.RaiseAssetTableEntryRemoved(this, table, tableEntry, removedAssetGuid); } }
void RemoveEntryAssetType(TableEntryReference tableEntry, string entryCode) { long keyId = tableEntry.ReferenceType == TableEntryReference.Type.Name ? SharedData.GetId(tableEntry.Key) : tableEntry.KeyId; if (keyId == SharedTableData.EmptyId) { return; } // Update type metadata // We cant use a foreach here as we are sometimes inside of a loop and exceptions will be thrown (Collection was modified). for (int i = 0; i < SharedData.Metadata.MetadataEntries.Count; ++i) { var md = SharedData.Metadata.MetadataEntries[i]; if (md is AssetTypeMetadata at) { if (at.Contains(keyId)) { at.RemoveEntry(keyId, entryCode); if (at.IsEmpty) { SharedData.Metadata.RemoveMetadata(at); } return; } } } }
public void Init(AsyncOperationHandle <AssetTable> loadTableOperation, TableEntryReference tableEntryReference) { m_LoadTableOperation = loadTableOperation; AddressablesInterface.Acquire(m_LoadTableOperation); m_TableEntryReference = tableEntryReference; }
public void AssigningIntId_SetsTypeTo_Id() { TableEntryReference tableEntryReference = 123; Assert.AreEqual(TableEntryReference.Type.Id, tableEntryReference.ReferenceType, "Expected type to be Id when assigning an integer."); Assert.AreEqual(123, tableEntryReference.KeyId, "Expected reference id to be set."); Assert.IsNull(tableEntryReference.Key, "Key should not be set when using a Key Id."); }
public void AssigningIntId_ReturnsTheSameIdWithImplicitConversion() { const uint id = 432; TableEntryReference tableEntryReference = id; uint implicitId = tableEntryReference; Assert.AreEqual(id, implicitId, "Expected the same id to be returned when assigning a TableEntryReference to a uint."); }
public void AssigningStringName_ReturnsTheSameNameWithImplicitConversion() { const string name = "key name"; TableEntryReference tableEntryReference = name; string implicitName = tableEntryReference; Assert.AreEqual(name, implicitName, "Expected the same Name to be returned when assigning a TableEntryReference to a string."); }
public void AssigningStringName_SetsTypeTo_Name() { TableEntryReference tableEntryReference = "Name"; Assert.AreEqual(TableEntryReference.Type.Name, tableEntryReference.ReferenceType, "Expected type to be Name when assigning a string."); Assert.AreEqual("Name", tableEntryReference.Key, "Expected reference id to be set."); Assert.AreEqual(SharedTableData.EmptyId, tableEntryReference.KeyId, "Key id be EmptyId when using a Name."); }
void SetEntryAssetType(TableEntryReference tableEntry, Type assetType, string entryCode) { long keyId = tableEntry.ReferenceType == TableEntryReference.Type.Name ? SharedData.GetId(tableEntry.Key, true) : tableEntry.KeyId; // Update type metadata AssetTypeMetadata entryMetadata = null; AssetTypeMetadata typeMetadata = null; // We cant use a foreach here as we are sometimes inside of a loop and exceptions will be thrown (Collection was modified). for (int i = 0; i < SharedData.Metadata.MetadataEntries.Count; ++i) { var md = SharedData.Metadata.MetadataEntries[i]; if (md is AssetTypeMetadata at) { if (at.Contains(keyId)) { if (!at.Type.IsAssignableFrom(assetType)) { at.RemoveEntry(keyId, entryCode); if (at.IsEmpty) { SharedData.Metadata.RemoveMetadata(at); } // Are other tables still using the type for the same id? if (at.Contains(tableEntry.KeyId)) { var name = SharedData.GetEntry(tableEntry.KeyId); Debug.LogWarning($"Table entry {name}({tableEntry.KeyId}) contains mixed types. Both {at.Type} and {assetType} are used."); } } else { entryMetadata = at; break; } } if (at.Type == assetType) { typeMetadata = at; break; } } } var foundMetadata = entryMetadata ?? typeMetadata; if (foundMetadata == null) { foundMetadata = new AssetTypeMetadata() { Type = assetType }; SharedData.Metadata.AddMetadata(foundMetadata); } foundMetadata.AddEntry(keyId, entryCode); }
/// <summary> /// Returns a handle to a localized asset loading operation from the <see cref="LocalizedAssetDatabase.DefaultTable"/>. /// This function is asynchronous and may not have an immediate result available. /// Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation. /// </summary> /// <typeparam name="TObject">The type of asset that should be loaded.</typeparam> /// <param name="tableEntryReference">A reference to the entry in the <see cref="LocalizedAssetDatabase.DefaultTable"/></param> /// <returns></returns> public AsyncOperationHandle <TObject> GetLocalizedAssetAsync <TObject>(TableEntryReference tableEntryReference, Locale locale) where TObject : Object { if (locale == null) { throw new ArgumentNullException(nameof(locale)); } return(GetLocalizedAssetAsync <TObject>(DefaultTable, tableEntryReference, locale)); }
public void Init(AsyncOperationHandle <LocalizedDatabase <StringTable, StringTableEntry> .TableEntryResult> tableEntryOperation, Locale locale, LocalizedStringDatabase database, TableReference tableReference, TableEntryReference tableEntryReference, object[] arguments) { m_TableEntryOperation = tableEntryOperation; m_SelectedLocale = locale; AddressablesInterface.Acquire(m_TableEntryOperation); m_Database = database; m_TableReference = tableReference; m_TableEntryReference = tableEntryReference; m_Arguments = arguments; }
public void Init(LocalizedDatabase <TTable, TEntry> database, AsyncOperationHandle <TTable> loadTableOperation, TableReference tableReference, TableEntryReference tableEntryReference, Locale selectedLoale, bool UseFallBack) { m_Database = database; m_LoadTableOperation = loadTableOperation; AddressablesInterface.Acquire(m_LoadTableOperation); m_TableReference = tableReference; m_TableEntryReference = tableEntryReference; m_SelectedLocale = selectedLoale; m_UseFallback = UseFallBack; }
/// <summary> /// The type of asset that is expected by this entry. By default this is determined by the first asset that is added in the Editor /// however this can be used to override it so it always expects this asset type instead of reverting back to Object when the last asset is removed. /// </summary> /// <param name="tableEntry">The entry to set the asset type for.</param> /// <param name="assetType">The asset type to expect for this entry. To reset the override and allow the Editor to control the type pass <c>null</c> or <c>typeof(Object)</c>.</param> public void SetEntryAssetType(TableEntryReference tableEntry, Type assetType) { if (assetType == null || assetType == typeof(Object)) { RemoveEntryAssetType(tableEntry, k_AssetTypeSetByScript); } else { SetEntryAssetType(tableEntry, assetType, k_AssetTypeSetByScript); } }
public void ResolveKeyName_ReturnsTheSameName_WhenTypeIsName() { const string keyName = "key name"; var sharedData = ScriptableObject.CreateInstance <SharedTableData>(); TableEntryReference tableEntryReference = keyName; Assert.AreEqual(keyName, tableEntryReference.ResolveKeyName(sharedData), "Expected key name to be the same when type is Name"); Object.DestroyImmediate(sharedData); }
public EntryOverrideType GetOverride(out TableReference tableReference, out TableEntryReference tableEntryReference) { if (DateTime.Now.DayOfWeek == day) { tableReference = myOverride.TableReference; tableEntryReference = myOverride.TableEntryReference; return(EntryOverrideType.TableAndEntry); } // Do not override. tableReference = default; tableEntryReference = default; return(EntryOverrideType.None); }
/// <summary> /// Returns the <see cref="EntryOverrideType"/> for the platform. /// </summary> /// <param name="tableReference">The table to use or <c>default</c> if it is not overriden.</param> /// <param name="tableEntryReference">The entry to use or <c>default</c> if it is not overriden.</param> /// <param name="platform">The platform to return the override for.</param> /// <returns>Returns the fields that should be overridden.</returns> public EntryOverrideType GetOverride(out TableReference tableReference, out TableEntryReference tableEntryReference, RuntimePlatform platform) { for (int i = 0; i < m_PlatformOverrides.Count; ++i) { if (m_PlatformOverrides[i].platform == platform) { var po = m_PlatformOverrides[i]; tableReference = po.tableReference; tableEntryReference = po.tableEntryReference; return(po.entryOverrideType); } } tableReference = default; tableEntryReference = default; return(EntryOverrideType.None); }
/// <summary> /// Returns the expected type for the entry. /// When an asset is first added to an entry, the type is recorded so that the Editor can ensure all subsequent assets that are added are compatible. /// </summary> /// <param name="tableEntry">The entry to return the asset type for.</param> /// <returns>The expected asset type or typeof(Object) if unknown.</returns> public Type GetEntryAssetType(TableEntryReference tableEntry) { long keyId = tableEntry.ReferenceType == TableEntryReference.Type.Name ? SharedData.GetId(tableEntry.Key) : tableEntry.KeyId; foreach (AssetTypeMetadata assetType in SharedData.Metadata.MetadataEntries) { if (assetType == null) { continue; } if (assetType.Contains(keyId)) { return(assetType.Type); } } return(typeof(Object)); }
public void ResolveKeyName_ReturnsNull_WhenKeyIdIsNotInSharedTableData() { const string keyName = "key name"; var sharedData = ScriptableObject.CreateInstance <SharedTableData>(); sharedData.AddKey("some key 1"); sharedData.AddKey("some key 2"); sharedData.AddKey("some key 3"); sharedData.AddKey(keyName); TableEntryReference tableEntryReference = 123; Assert.AreEqual(TableEntryReference.Type.Id, tableEntryReference.ReferenceType); Assert.IsNull(tableEntryReference.ResolveKeyName(sharedData), "Expected null to be returned when the key id can not be found."); Object.DestroyImmediate(sharedData); }
public void ResolveKeyName_ReturnsNull_ForEmptyReference() { const string keyName = "key name"; var sharedData = ScriptableObject.CreateInstance <SharedTableData>(); sharedData.AddKey("some key 1"); sharedData.AddKey("some key 2"); sharedData.AddKey("some key 3"); sharedData.AddKey(keyName); TableEntryReference tableEntryReference = new TableEntryReference(); Assert.AreEqual(TableEntryReference.Type.Empty, tableEntryReference.ReferenceType); Assert.IsNull(tableEntryReference.ResolveKeyName(sharedData), "Expected null to be returned when the reference is Empty."); Object.DestroyImmediate(sharedData); }
/// <summary> /// Returns the <see cref="EntryOverrideType"/> for the platform the application is currently running on using [Application.platform](https://docs.unity3d.com/ScriptReference/Application-platform.html). /// </summary> /// <param name="tableReference">The table to use or <c>default</c> if it is not overriden.</param> /// <param name="tableEntryReference">The entry to use or <c>default</c> if it is not overriden.</param> /// <returns>Returns the fields that should be overridden.</returns> public EntryOverrideType GetOverride(out TableReference tableReference, out TableEntryReference tableEntryReference) { #if UNITY_EDITOR return(GetOverride(out tableReference, out tableEntryReference, LocalizationSettings.Instance.Platform)); #else if (m_PlayerPlatformOverride == null) { tableReference = default; tableEntryReference = default; return(EntryOverrideType.None); } else { tableReference = m_PlayerPlatformOverride.tableReference; tableEntryReference = m_PlayerPlatformOverride.tableEntryReference; return(m_PlayerPlatformOverride.entryOverrideType); } #endif }
public void ResolveKeyName_ReturnsTheNameFromTheSharedTableData_WhenTypeIsKeyId() { const string keyName = "key name"; var sharedData = ScriptableObject.CreateInstance <SharedTableData>(); sharedData.AddKey("some key 1"); sharedData.AddKey("some key 2"); sharedData.AddKey("some key 3"); var keyEntry = sharedData.AddKey(keyName); TableEntryReference tableEntryReference = keyEntry.Id; Assert.AreEqual(TableEntryReference.Type.Id, tableEntryReference.ReferenceType); Assert.AreEqual(keyName, tableEntryReference.ResolveKeyName(sharedData), "Expected key name to be extracted from SharedTableData type is Id"); Object.DestroyImmediate(sharedData); }
/// <summary> /// Removes the entry from the <see cref="SharedTableData"/> and all tables that are part of this collection. /// </summary> /// <param name="id"></param> public override void RemoveEntry(TableEntryReference entryReference) { if (entryReference.ReferenceType == TableEntryReference.Type.Name) { SharedData.RemoveKey(entryReference.Key); foreach (var table in StringTables) { table.SharedData.RemoveKey(entryReference.Key); } } else if (entryReference.ReferenceType == TableEntryReference.Type.Id) { SharedData.RemoveKey(entryReference.KeyId); foreach (var table in StringTables) { table.SharedData.RemoveKey(entryReference.KeyId); } } }
/// <summary> /// Release an asset for a single entry that have been preloaded or cached /// </summary> /// <param name="entry">A reference to the entry in the table.</param> /// <returns></returns> public void ReleaseAsset(TableEntryReference entry) { ReleaseAsset(GetEntryFromReference(entry)); }
/// <summary> /// Add a localized asset to the asset table. /// This function will ensure the localization system adds the asset to the Addressables system and sets the asset up for use. /// </summary> /// <param name="table">The table to add the asset to, must be part of the collection.</param> /// <param name="entryReference">The table entry Key or Key Id.</param> /// <param name="asset">The asset to add.</param> /// <param name="createUndo">Should an undo operation be created?</param> public virtual void AddAssetToTable(AssetTable table, TableEntryReference entryReference, Object asset, bool createUndo = false) { if (table == null) { throw new ArgumentNullException(nameof(table), "Can not add asset to null table"); } if (asset == null) { throw new ArgumentNullException(nameof(asset), "Can not add null asset to table"); } if (!ContainsTable(table)) { throw new Exception("The table does not belong to this collection."); } if (!EditorUtility.IsPersistent(table)) { throw new AssetNotPersistentException(table); } if (!EditorUtility.IsPersistent(asset)) { throw new AssetNotPersistentException(asset); } // Add the asset to the Addressables system and setup the table with the key to guid mapping. var aaSettings = LocalizationEditorSettings.Instance.GetAddressableAssetSettings(true); if (aaSettings == null) { return; } var undoGroup = Undo.GetCurrentGroup(); if (createUndo) { Undo.RecordObject(aaSettings, "Add asset to table"); } // Remove the old asset first var assetGuid = LocalizationEditorSettings.Instance.GetAssetGuid(asset); var tableEntry = table.GetEntryFromReference(entryReference); if (tableEntry != null) { if (tableEntry.Guid == assetGuid) { return; } RemoveAssetFromTable(table, entryReference, createUndo); } // Has the asset already been added? Perhaps it is being used by multiple tables or the user has added it manually. var entry = aaSettings.FindAssetEntry(assetGuid); var entryLabel = AddressHelper.FormatAssetLabel(table.LocaleIdentifier.Code); aaSettings.AddLabel(entryLabel); if (entry == null) { var group = LocalizationEditorSettings.Instance.GetGroup(aaSettings, FormatAssetTableCollectionName(table.LocaleIdentifier), true, createUndo); if (createUndo) { Undo.RecordObject(group, "Add asset to table"); } entry = aaSettings.CreateOrMoveEntry(assetGuid, group, true); entry.SetLabel(entryLabel, true); entry.address = LocalizationEditorSettings.Instance.FindUniqueAssetAddress(asset.name); } else { Undo.RecordObject(entry.parentGroup, "Add asset to table"); entry.SetLabel(entryLabel, true); UpdateAssetGroup(aaSettings, entry, createUndo); } // Update the table if (createUndo) { Undo.RecordObject(table, "Add asset to table"); Undo.RecordObject(table.SharedData, "Add asset to table"); } //else // Asset changes are not being saved correctly at the moment when using Undo. (LOC-82) { EditorUtility.SetDirty(table); EditorUtility.SetDirty(table.SharedData); } tableEntry = table.AddEntryFromReference(entryReference, assetGuid); // Update type metadata AssetTypeMetadata entryMetadata = null; AssetTypeMetadata typeMetadata = null; var assetType = asset.GetType(); // We cant use a foreach here as we are sometimes inside of a loop and exceptions will be thrown (Collection was modified). for (int i = 0; i < table.SharedData.Metadata.MetadataEntries.Count; ++i) { var md = table.SharedData.Metadata.MetadataEntries[i]; if (md is AssetTypeMetadata at) { if (at.Contains(tableEntry.KeyId)) { if (!at.Type.IsAssignableFrom(assetType)) { tableEntry.RemoveSharedMetadata(at); // Are other tables still using the type for the same id? if (at.Contains(tableEntry.KeyId)) { var name = SharedData.GetEntry(tableEntry.KeyId); Debug.LogWarning($"Table entry {name}({tableEntry.KeyId}) contains mixed types. Both {at.Type} and {assetType} are used."); } } else { entryMetadata = at; break; } } if (at.Type == assetType) { typeMetadata = at; break; } } } var foundMetadata = entryMetadata ?? typeMetadata; if (foundMetadata == null) { foundMetadata = new AssetTypeMetadata() { Type = assetType }; } tableEntry.AddSharedMetadata(foundMetadata); if (createUndo) { Undo.CollapseUndoOperations(undoGroup); } LocalizationEditorSettings.EditorEvents.RaiseAssetTableEntryAdded(this, table, tableEntry); }
/// <summary> /// Remove the asset mapping from the table entry and also cleans up the Addressables if necessary. /// </summary> /// <param name="table"></param> /// <param name="entryReference"></param> /// <param name="createUndo"></param> public void RemoveAssetFromTable(AssetTable table, TableEntryReference entryReference, bool createUndo = false) { var undoGroup = Undo.GetCurrentGroup(); if (createUndo) { Undo.RecordObject(table, "Remove asset from table"); // We modify the table entry. Undo.RecordObject(table.SharedData, "Remove asset from table"); // We modify the shared table metadata. } //else // Asset changes are not being saved correctly at the moment when using Undo. (LOC-82) { EditorUtility.SetDirty(table); EditorUtility.SetDirty(table.SharedData); } // Clear the asset but keep the key var tableEntry = table.GetEntryFromReference(entryReference); if (tableEntry == null) { return; } var removedAssetGuid = tableEntry.Guid; tableEntry.Guid = string.Empty; var aaSettings = LocalizationEditorSettings.Instance.GetAddressableAssetSettings(false); if (aaSettings == null) { return; } // Update type metadata // We cant use a foreach here as we are sometimes inside of a loop and exceptions will be thrown (Collection was modified). for (int i = 0; i < table.SharedData.Metadata.MetadataEntries.Count; ++i) { var md = table.SharedData.Metadata.MetadataEntries[i]; if (md is AssetTypeMetadata at) { if (at.Contains(tableEntry.KeyId)) { tableEntry.RemoveSharedMetadata(at); } } } // If the entry has metadata then we will leave an empty entry otherwise we just remove the whole thing. if (tableEntry.MetadataEntries.Count == 0) { table.RemoveEntry(tableEntry.KeyId); } // Determine if the asset is being referenced by any entries or tables with the same locale, if not then we can // remove the locale label and if no other labels exist also remove the asset from the Addressables system. var assetTableCollections = LocalizationEditorSettings.GetAssetTableCollections(); foreach (var collection in assetTableCollections) { var tableWithMatchingLocaleId = collection.GetTable(table.LocaleIdentifier) as AssetTable; if (tableWithMatchingLocaleId == null) { continue; } if (tableWithMatchingLocaleId.ContainsValue(removedAssetGuid)) { // The asset is referenced elsewhere so we can not remove the label or asset. return; } } // Remove the locale label for this asset var assetEntry = aaSettings.FindAssetEntry(removedAssetGuid); if (assetEntry != null) { if (createUndo) { Undo.RecordObject(assetEntry.parentGroup, "Remove asset from table"); } var assetLabel = AddressHelper.FormatAssetLabel(table.LocaleIdentifier); assetEntry.SetLabel(assetLabel, false); UpdateAssetGroup(aaSettings, assetEntry, createUndo); } if (createUndo) { Undo.CollapseUndoOperations(undoGroup); } LocalizationEditorSettings.EditorEvents.RaiseAssetTableEntryRemoved(this, table, tableEntry, removedAssetGuid); }
public override AsyncOperationHandle <TableEntryResult> GetTableEntryAsync(TableReference tableReference, TableEntryReference tableEntryReference, Locale locale, FallbackBehavior fallbackBehavior) { LastTableReference = tableReference; LastTableEntryReference = tableEntryReference; return(AddressablesInterface.ResourceManager.CreateCompletedOperation(new TableEntryResult(), null)); }
public abstract void RemoveEntry(TableEntryReference entryReference);
/// <summary> /// Implementation for all versions of <see cref="GetLocalizedAssetAsync"/>. /// </summary> /// <typeparam name="TObject">The type of asset that should be loaded.</typeparam> /// <param name="tableReference">A reference to the table that the asset should be loaded from.</param> /// <param name="tableEntryReference">A reference to the entry in the table.</param> /// <param name="locale">The <see cref="Locale"/> to use instead of the default <see cref="LocalizationSettings.SelectedLocale"/></param> protected virtual AsyncOperationHandle <TObject> GetLocalizedAssetAsyncInternal <TObject>(TableReference tableReference, TableEntryReference tableEntryReference, Locale locale) where TObject : Object { var tableEntryOp = GetTableEntryAsync(tableReference, tableEntryReference, locale); if (!tableEntryOp.IsDone) { return(ResourceManager.CreateChainOperation <TObject>(tableEntryOp, (op) => GetLocalizedAssetLoadAsset <TObject>(tableEntryOp, tableEntryReference))); } return(GetLocalizedAssetLoadAsset <TObject>(tableEntryOp, tableEntryReference)); }
/// <summary> /// Returns a handle to a localized asset loading operation from the requested table. /// This function is asynchronous and may not have an immediate result available. /// Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation. /// </summary> /// <typeparam name="TObject">The type of asset that should be loaded.</typeparam> /// <param name="tableReference">A reference to the table that the asset should be loaded from.</param> /// <param name="tableEntryReference">A reference to the entry in the table.</param> public virtual AsyncOperationHandle <TObject> GetLocalizedAssetAsync <TObject>(TableReference tableReference, TableEntryReference tableEntryReference) where TObject : Object { var locale = LocalizationSettings.SelectedLocaleAsync; if (!locale.IsDone) { return(ResourceManager.CreateChainOperation(locale, (op) => GetLocalizedAssetAsync <TObject>(tableReference, tableEntryReference, op.Result))); } return(GetLocalizedAssetAsync <TObject>(tableReference, tableEntryReference, locale.Result)); }
/// <summary> /// Returns a handle to a localized asset loading operation from the <see cref="LocalizedAssetDatabase.DefaultTable"/>. /// This function is asynchronous and may not have an immediate result available. /// Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation. /// </summary> /// <typeparam name="TObject">The type of asset that should be loaded.</typeparam> /// <param name="tableEntryReference">A reference to the entry in the <see cref="LocalizedAssetDatabase.DefaultTable"/></param> /// <param name="locale">The <see cref="Locale"/> to use instead of the default <see cref="LocalizationSettings.SelectedLocale"/></param> /// <returns></returns> public AsyncOperationHandle <TObject> GetLocalizedAssetAsync <TObject>(TableEntryReference tableEntryReference) where TObject : Object { return(GetLocalizedAssetAsync <TObject>(DefaultTable, tableEntryReference)); }