Class LocalizedAsset<TObject>
Provides a way to reference an AssetTableEntry inside of a specific AssetTable and request the localized asset.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.Localization
Assembly: Unity.Localization.dll
Syntax
[Serializable]
[UxmlObject]
public class LocalizedAsset<TObject> : LocalizedAssetBase, ISerializationCallbackReceiver where TObject : Object
Type Parameters
| Name | Description |
|---|---|
| TObject | The type that should be supported. This can be any type that inherits from UnityEngine.Object. |
Examples
This example shows how a LocalizedAsset<TObject> can be used to localize a Prefabs. See also LocalizedGameObject and LocalizedGameObjectEvent.
This example shows how a LocalizedAsset<TObject> can be used to localize a ScriptableObject.
This example shows how to bind to a UI Toolkit property. Note that this requires Unity 2023.2 and above.
Constructors
| Name | Description |
|---|---|
| LocalizedAsset() | Initializes and returns an empty instance of a LocalizedAsset<TObject>. |
Properties
| Name | Description |
|---|---|
| CurrentLoadingOperation | The current loading operation for the asset when using AssetChanged. This is null if a loading operation is not available. |
| CurrentLoadingOperationHandle | The current loading operation for the asset when using AssetChanged. This is default if a loading operation is not available. |
| HasChangeHandler | Returns true if AssetChanged has any subscribers. |
| WaitForCompletion | Determines if WaitForCompletion should be used to force loading to be completed immediately. See Synchronous Workflow for further details. Please note that WaitForCompletion is not supported on WebGL. |
Methods
| Name | Description |
|---|---|
| ApplyDataBindingValue(in BindingContext, TObject) | Applies the |
| Cleanup() | |
| ClearChangeHandler() | |
| ForceUpdate() | |
| Initialize() | |
| LoadAsset() | Provides a localized asset from a AssetTable with the TableReference and the the asset that matches TableEntryReference. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL. |
| LoadAssetAsObjectAsync() | Returns the localized asset as a UnityEngine.Object. |
| LoadAssetAsync() | Provides a localized asset from a AssetTable with the TableReference and the the asset that matches TableEntryReference. |
| LoadAssetAsync<T>() | Overrides the asset's default type. This loads a type from AssetTable with the TableReference and the
the asset that matchesTableEntryReference.
This helps to filter sub-assets when trying to load them and they share a common type among other sub-assets with the same name.
|
| RegisterChangeHandler(ChangeHandler) | |
| Reset() | Called when values are changed due to a change made via serialization, such as via the inspector. |
| Update(in BindingContext) |
Events
| Name | Description |
|---|---|
| AssetChanged | Provides a callback that will be invoked when the asset is available or has changed. |