diff --git a/Editor/Commands/CompileDllCommand.cs b/Editor/Commands/CompileDllCommand.cs index c3d9547..4bc95c8 100644 --- a/Editor/Commands/CompileDllCommand.cs +++ b/Editor/Commands/CompileDllCommand.cs @@ -25,6 +25,7 @@ namespace HybridCLR.Editor.Commands { //Debug.LogFormat("compile assemblies:{1}/{0}", ass, buildDir); } + Debug.Log("compile finish!!!"); } public static void CompileDll(BuildTarget target) diff --git a/Editor/Meta/UnityPluginAssemblyResolver.cs b/Editor/Meta/UnityPluginAssemblyResolver.cs new file mode 100644 index 0000000..c77c0b0 --- /dev/null +++ b/Editor/Meta/UnityPluginAssemblyResolver.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace HybridCLR.Editor.Meta +{ + public class UnityPluginAssemblyResolver : IAssemblyResolver + { + public string ResolveAssembly(string assemblyName, bool throwExIfNotFind) + { + foreach(var dll in Directory.GetFiles(UnityEngine.Application.dataPath, "*.dll", SearchOption.AllDirectories)) + { + if (Path.GetFileNameWithoutExtension(dll) == assemblyName) + { + Debug.Log($"plugin:{dll}"); + return dll; + } + } + if (throwExIfNotFind) + { + throw new Exception($"resolve assembly:{assemblyName} fail"); + } + return null; + } + } +} diff --git a/Editor/Meta/UnityPluginAssemblyResolver.cs.meta b/Editor/Meta/UnityPluginAssemblyResolver.cs.meta new file mode 100644 index 0000000..707e174 --- /dev/null +++ b/Editor/Meta/UnityPluginAssemblyResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6c235be11c219a74fa5eb55ed54e7662 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/MetaUtil.cs b/Editor/MetaUtil.cs index 0b5aab0..78d4e95 100644 --- a/Editor/MetaUtil.cs +++ b/Editor/MetaUtil.cs @@ -2,6 +2,7 @@ using HybridCLR.Editor.Meta; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -83,8 +84,11 @@ namespace HybridCLR.Editor public static IAssemblyResolver CreateBuildTargetAssemblyResolver(UnityEditor.BuildTarget target) { + List searchPaths = new List { SettingsUtil.GetHotFixDllsOutputDirByTarget(target) }; return new CombinedAssemblyResolver(new PathAssemblyResolver( - SettingsUtil.GetHotFixDllsOutputDirByTarget(target)), new UnityEditorAssemblyResolver()); + SettingsUtil.GetHotFixDllsOutputDirByTarget(target)), + new UnityPluginAssemblyResolver(), + new UnityEditorAssemblyResolver()); } } } diff --git a/package.json b/package.json index b4bd2ba..151a139 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.focus-creative-games.hybridclr_unity", - "version": "0.3.0", + "version": "0.3.1", "displayName": "HybridCLR", "description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR", "category": "Runtime",