Table of Contents

Class SoftAssetReferenceEditorUtils

Namespace
Ceres.Resource.Editor
Assembly
Ceres.Editor.dll
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

asset Object
groupName string
registerAddressable bool

Whether to create an Addressable entry when one does not exist.

Returns

SoftAssetReference

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

asset T

The asset to create reference from

groupName string

Optional addressable group name, uses default if null

registerAddressable bool

Returns

SoftAssetReference<T>

A typed soft asset reference

Type Parameters

T

The 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

softAssetReference SoftAssetReferenceBase

The 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

guid string

Returns

Object

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

reference SoftAssetReference

The soft asset reference to move

group AddressableAssetGroup

The target addressable asset group

labels string[]

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

softAssetReference SoftAssetReferenceBase
assetPath string

Returns

bool