Class SoftAssetReferenceEditorUtils
public static class SoftAssetReferenceEditorUtils
- Inheritance
-
SoftAssetReferenceEditorUtils
- Inherited Members
Methods
FromObject(Object, string, bool)
Create a soft asset reference from object
public static SoftAssetReference FromObject(Object asset, string groupName = null, bool registerAddressable = true)
Parameters
assetObjectgroupNamestringregisterAddressableboolWhether to create an Addressable entry when one does not exist.
Returns
FromTObject<T>(T, string, bool)
Create a generic soft asset reference from object with type safety
public static SoftAssetReference<T> FromTObject<T>(T asset, string groupName = null, bool registerAddressable = true) where T : Object
Parameters
assetTThe asset to create reference from
groupNamestringOptional addressable group name, uses default if null
registerAddressablebool
Returns
- SoftAssetReference<T>
A typed soft asset reference
Type Parameters
TThe type of the asset, must inherit from UnityEngine.Object
GetAsset(SoftAssetReferenceBase)
Get asset from soft asset reference, fallback to addressable system if GUID lookup fails
public static Object GetAsset(SoftAssetReferenceBase softAssetReference)
Parameters
softAssetReferenceSoftAssetReferenceBaseThe soft asset reference to load
Returns
- Object
The loaded asset or null if not found
GetAssetFromGUID(string)
Optimized fast api for load asset from guid in editor
public static Object GetAssetFromGUID(string guid)
Parameters
guidstring
Returns
MoveSoftReferenceObject(ref SoftAssetReference, AddressableAssetGroup, params string[])
Move SoftAssetReference asset to target UnityEditor.AddressableAssets.Settings.AddressableAssetGroup safe in editor
public static void MoveSoftReferenceObject(ref SoftAssetReference reference, AddressableAssetGroup group, params string[] labels)
Parameters
referenceSoftAssetReferenceThe soft asset reference to move
groupAddressableAssetGroupThe target addressable asset group
labelsstring[]Asset labels to assign to the moved asset
TryGetAssetPath(SoftAssetReferenceBase, out string)
Resolve the AssetDatabase path stored by a soft reference without loading the asset.
public static bool TryGetAssetPath(SoftAssetReferenceBase softAssetReference, out string assetPath)
Parameters
softAssetReferenceSoftAssetReferenceBaseassetPathstring