CodeSmile AssetDatabase 1.10
Unity's AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.
Loading...
Searching...
No Matches
Asset.Status.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;
7using Object = UnityEngine.Object;
8
9namespace CodeSmileEditor
10{
11 public sealed partial class Asset
12 {
16 public static class Status
17 {
33 public static Boolean IsImported([NotNull] Object instance) => Database.Contains(instance);
34
51 public static Boolean IsImported([NotNull] Path path) => path != null && path.Exists;
52
63 [ExcludeFromCodeCoverage] // simple relay
64 public static Boolean IsLoaded([NotNull] Path path) => AssetDatabase.IsMainAssetAtPathLoaded(path);
65
75 [ExcludeFromCodeCoverage] // simple relay
76 public static Boolean IsMain([NotNull] Object asset) => AssetDatabase.IsMainAsset(asset);
77
87 [ExcludeFromCodeCoverage] // simple relay
88 public static Boolean IsSub([NotNull] Object asset) => AssetDatabase.IsSubAsset(asset);
89
104 [ExcludeFromCodeCoverage] // simple relay
105 public static Boolean IsForeign([NotNull] Object asset) => AssetDatabase.IsForeignAsset(asset);
106
121 [ExcludeFromCodeCoverage] // simple relay
122 public static Boolean IsNative([NotNull] Object asset) => AssetDatabase.IsNativeAsset(asset);
123
129 public static Boolean IsScene([NotNull] Object asset) => asset is SceneAsset;
130 }
131 }
132}
static Boolean Contains(Object instance)
Tests if the asset is in the database.
Groups all asset database functionality.
Represents a relative path to an asset file or folder, typically under 'Assets' or 'Packages'.
Definition Asset.Path.cs:25
static Boolean IsMain([NotNull] Object asset)
Returns whether this object is the asset's 'main' object.
static Boolean IsImported([NotNull] Path path)
Checks if the path is in the AssetDatabase.
static Boolean IsScene([NotNull] Object asset)
Returns true if the given object is of type SceneAsset.
static Boolean IsForeign([NotNull] Object asset)
Returns whether this is a foreign asset.
static Boolean IsLoaded([NotNull] Path path)
Returns whether the (main) asset at the path is loaded.
static Boolean IsSub([NotNull] Object asset)
Returns whether this object is a sub-asset of a composite asset.
static Boolean IsNative([NotNull] Object asset)
Returns whether this is a native asset.
static Boolean IsImported([NotNull] Object instance)
Checks if the object is an asset in the AssetDatabase.
Groups asset status related functions.
Replacement implementation for Unity's massive AssetDatabase class with a cleaner interface and more ...