CodeSmile AssetDatabase 1.9
Unity's AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.
Loading...
Searching...
No Matches
Asset.Package.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
8namespace CodeSmileEditor
9{
10 public sealed partial class Asset
11 {
19 public static class Package
20 {
30 [ExcludeFromCodeCoverage] // simple relay
31 public static void Import([NotNull] Path packagePath)
32 {
33 ThrowIf.ExtensionIsNotUnityPackage(packagePath);
34
35 AssetDatabase.ImportPackage(packagePath, false);
36 }
37
48 [ExcludeFromCodeCoverage] // not testable
49 public static void ImportInteractive([NotNull] Path packagePath)
50 {
51 ThrowIf.ExtensionIsNotUnityPackage(packagePath);
52
53 AssetDatabase.ImportPackage(packagePath, true);
54 }
55
69 public static void Export([NotNull] Path assetPath, [NotNull] String packagePath,
70 ExportPackageOptions options = ExportPackageOptions.Default)
71 {
72 ThrowIf.ExtensionIsNotUnityPackage(packagePath);
73
74 AssetDatabase.ExportPackage(assetPath, packagePath, options);
75 }
76
90 public static void Export([NotNull] Path[] assetPaths, [NotNull] String packagePath,
91 ExportPackageOptions options = ExportPackageOptions.Default) =>
92 Export(Path.ToStrings(assetPaths), packagePath, options);
93
107 public static void Export([NotNull] String[] assetPaths, [NotNull] String packagePath,
108 ExportPackageOptions options = ExportPackageOptions.Default)
109 {
110 ThrowIf.ExtensionIsNotUnityPackage(packagePath);
111
112 AssetDatabase.ExportPackage(assetPaths, packagePath, options);
113 }
114 }
115 }
116}
static void Export([NotNull] Path[] assetPaths, [NotNull] String packagePath, ExportPackageOptions options=ExportPackageOptions.Default)
Exports multiple assets and their dependencies to the packagePath file.
static void Export([NotNull] String[] assetPaths, [NotNull] String packagePath, ExportPackageOptions options=ExportPackageOptions.Default)
Exports multiple assets and their dependencies to the packagePath file.
static void ImportInteractive([NotNull] Path packagePath)
Imports a .unitypackage file at the given path interactively.
static void Export([NotNull] Path assetPath, [NotNull] String packagePath, ExportPackageOptions options=ExportPackageOptions.Default)
Exports the asset and its dependencies to a .unitypackage file.
static void Import([NotNull] Path packagePath)
Silently imports a .unitypackage file at the given path.
Groups import/export functionality for .unitypackage files (Asset Packages).
static String[] ToStrings([NotNull] IEnumerable< Path > paths)
Converts an IEnumerable collection of Path instances to a string array.
Represents a relative path to an asset file or folder, typically under 'Assets' or 'Packages'.
Definition Asset.Path.cs:25