From bef90bf3b8de231fa7366ea3ac9de8895213ec32 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 26 Apr 2024 16:05:13 +0800 Subject: [PATCH] perf : check build pipeline parameter type --- .../BuiltinBuildPipeline/BuiltinBuildPipeline.cs | 11 +++++++++-- .../RawFileBuildPipeline/RawFileBuildPipeline.cs | 11 +++++++++-- .../ScriptableBuildPipeline.cs | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs index 2ac4058..177803f 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs @@ -8,8 +8,15 @@ namespace YooAsset.Editor { public BuildResult Run(BuildParameters buildParameters, bool enableLog) { - AssetBundleBuilder builder = new AssetBundleBuilder(); - return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog); + if (buildParameters is BuiltinBuildParameters) + { + AssetBundleBuilder builder = new AssetBundleBuilder(); + return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog); + } + else + { + throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}"); + } } /// diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs index 7865150..e220a0b 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs @@ -11,8 +11,15 @@ namespace YooAsset.Editor { public BuildResult Run(BuildParameters buildParameters, bool enableLog) { - AssetBundleBuilder builder = new AssetBundleBuilder(); - return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog); + if (buildParameters is RawFileBuildParameters) + { + AssetBundleBuilder builder = new AssetBundleBuilder(); + return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog); + } + else + { + throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}"); + } } /// diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs index db62db6..1e87ab9 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs @@ -8,8 +8,15 @@ namespace YooAsset.Editor { public BuildResult Run(BuildParameters buildParameters, bool enableLog) { - AssetBundleBuilder builder = new AssetBundleBuilder(); - return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog); + if (buildParameters is ScriptableBuildParameters) + { + AssetBundleBuilder builder = new AssetBundleBuilder(); + return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog); + } + else + { + throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}"); + } } ///