CodeSmile AssetDatabase 1.9
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 NUnit.Framework;
5using System;
6using System.Diagnostics.CodeAnalysis;
7using UnityEditor;
8using Object = UnityEngine.Object;
9
10namespace CodeSmileEditor
11{
12 public sealed partial class Asset
13 {
17 public static class Status
18 {
34 public static Boolean IsImported([NotNull] Object instance) => Database.Contains(instance);
35
52 public static Boolean IsImported([NotNull] Path path) => path != null && path.Exists;
53
64 [ExcludeFromCodeCoverage] // simple relay
65 public static Boolean IsLoaded([NotNull] Path path) => AssetDatabase.IsMainAssetAtPathLoaded(path);
66
76 [ExcludeFromCodeCoverage] // simple relay
77 public static Boolean IsMain([NotNull] Object asset) => AssetDatabase.IsMainAsset(asset);
78
88 [ExcludeFromCodeCoverage] // simple relay
89 public static Boolean IsSub([NotNull] Object asset) => AssetDatabase.IsSubAsset(asset);
90
105 [ExcludeFromCodeCoverage] // simple relay
106 public static Boolean IsForeign([NotNull] Object asset) => AssetDatabase.IsForeignAsset(asset);
107
122 [ExcludeFromCodeCoverage] // simple relay
123 public static Boolean IsNative([NotNull] Object asset) => AssetDatabase.IsNativeAsset(asset);
124
130 public static Boolean IsScene([NotNull] Object asset) => asset is SceneAsset;
131 }
132 }
133}
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.