Version 3.3.1.2

AssetUtilities class

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.Utilities.Editor
public static class AssetUtilities
Utility functions for Unity assets.
Inheritance
  • System.Object
  • AssetUtilities

Methods

CanCreateNewAsset<T>()
Tests if an asset can be created from a type.
public static bool CanCreateNewAsset<T>()
Returns
System.Boolean

true if an asset can be created. Otherwise false.

Type Parameters
T

The type to test.

CanCreateNewAsset<T>(out Type)
Tests if an asset can be created from a type.
public static bool CanCreateNewAsset<T>(out Type baseType)
Parameters
System.Type baseType

The base asset type.

Returns
System.Boolean

true if an asset can be created. Otherwise false.

Type Parameters
T

The type to test.

GetAllAssetsOfType(Type, String)
Gets all assets of the specified type.
public static IEnumerable<Object> GetAllAssetsOfType(Type type, string folderPath = null)
Parameters
System.Type type

The type of assets to find.

System.String folderPath

The asset folder path.

Returns
System.Collections.Generic.IEnumerable<UnityEngine.Object>

GetAllAssetsOfType<T>()
Gets all assets of the specified type.
public static IEnumerable<T> GetAllAssetsOfType<T>()
    where T : Object
Returns
System.Collections.Generic.IEnumerable<T>

Type Parameters
T

GetAllAssetsOfTypeWithProgress(Type, String)
Gets all assets of the specified type.
public static IEnumerable<AssetUtilities.AssetSearchResult> GetAllAssetsOfTypeWithProgress(Type type, string folderPath = null)
Parameters
System.Type type

The type of assets to find.

System.String folderPath

The asset folder path.

Returns
System.Collections.Generic.IEnumerable<AssetUtilities.AssetSearchResult>

GetAssetLocation(Object)
Gets project path to the specified asset.
public static string GetAssetLocation(Object obj)
Parameters
UnityEngine.Object obj

The asset object.

Returns
System.String

The path to the asset.