CodeSmile AssetDatabase 1.9
Unity's AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.
Loading...
Searching...
No Matches
Asset.Bundle.cs
1// Copyright (C) 2021-2023 Steffen Itterheim
2// Refer to included LICENSE file for terms and conditions.
3
4using System;
5using System.Diagnostics.CodeAnalysis;
6using UnityEditor;
7
9{
10 public sealed partial class Asset
11 {
18 public static class Bundle
19 {
28 public static String[] All => AssetDatabase.GetAllAssetBundleNames();
29
38 public static String[] Unused => AssetDatabase.GetUnusedAssetBundleNames();
39
51 public static void RemoveUnused() => AssetDatabase.RemoveUnusedAssetBundleNames();
52
63 public static void Remove([NotNull] String bundleName) => AssetDatabase.RemoveAssetBundleName(bundleName, false);
64
75 public static void ForceRemove([NotNull] String bundleName) => AssetDatabase.RemoveAssetBundleName(bundleName, true);
76
87 public static String[] GetDirectDependencies([NotNull] String bundleName) =>
88 AssetDatabase.GetAssetBundleDependencies(bundleName, false);
89
100 public static String[] GetAllDependencies([NotNull] String bundleName) =>
101 AssetDatabase.GetAssetBundleDependencies(bundleName, true);
102
113 public static String[] GetAllPaths([NotNull] String bundleName) => AssetDatabase.GetAssetPathsFromAssetBundle(bundleName);
114
126 public static String[] GetPaths([NotNull] String bundleName, [NotNull] String assetName) =>
127 AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(bundleName, assetName);
128
142 public static String GetOwningBundle([NotNull] Path path) => AssetDatabase.GetImplicitAssetBundleName(path);
143
157 public static String GetOwningBundleVariant([NotNull] Path path) => AssetDatabase.GetImplicitAssetBundleVariantName(path);
158 }
159 }
160}
static void RemoveUnused()
Removes all unused asset bundles.
static String[] Unused
Returns all unused asset bundle names.
static String GetOwningBundle([NotNull] Path path)
Returns the bundle name that contains the asset path.
static String GetOwningBundleVariant([NotNull] Path path)
Returns the bundle variant name that contains the asset path.
static void ForceRemove([NotNull] String bundleName)
Removes a specific asset bundle by name.
static String[] All
Returns all asset bundle names.
static String[] GetDirectDependencies([NotNull] String bundleName)
Returns the bundle names that the given asset bundle directly depends on.
static String[] GetAllPaths([NotNull] String bundleName)
Returns all asset paths that are part of a given asset bundle.
static String[] GetPaths([NotNull] String bundleName, [NotNull] String assetName)
Returns the asset paths in a given asset bundle that matches an asset name.
static String[] GetAllDependencies([NotNull] String bundleName)
Returns all bundle names that the given asset bundle depends on, directly or indirectly (recursive).
static void Remove([NotNull] String bundleName)
Removes a specific asset bundle by name.
Groups all asset bundle related functionality.
Represents a relative path to an asset file or folder, typically under 'Assets' or 'Packages'.
Definition Asset.Path.cs:25
Replacement implementation for Unity's massive AssetDatabase class with a cleaner interface and more ...