[fix] 修复plugin dll与Unity自带dll同名时,GenerateMethodBridge生成失败的bug
parent
07b56fe7e5
commit
cd68f33161
|
@ -25,6 +25,7 @@ namespace HybridCLR.Editor.Commands
|
||||||
{
|
{
|
||||||
//Debug.LogFormat("compile assemblies:{1}/{0}", ass, buildDir);
|
//Debug.LogFormat("compile assemblies:{1}/{0}", ass, buildDir);
|
||||||
}
|
}
|
||||||
|
Debug.Log("compile finish!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CompileDll(BuildTarget target)
|
public static void CompileDll(BuildTarget target)
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c235be11c219a74fa5eb55ed54e7662
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -2,6 +2,7 @@
|
||||||
using HybridCLR.Editor.Meta;
|
using HybridCLR.Editor.Meta;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -83,8 +84,11 @@ namespace HybridCLR.Editor
|
||||||
|
|
||||||
public static IAssemblyResolver CreateBuildTargetAssemblyResolver(UnityEditor.BuildTarget target)
|
public static IAssemblyResolver CreateBuildTargetAssemblyResolver(UnityEditor.BuildTarget target)
|
||||||
{
|
{
|
||||||
|
List<string> searchPaths = new List<string> { SettingsUtil.GetHotFixDllsOutputDirByTarget(target) };
|
||||||
return new CombinedAssemblyResolver(new PathAssemblyResolver(
|
return new CombinedAssemblyResolver(new PathAssemblyResolver(
|
||||||
SettingsUtil.GetHotFixDllsOutputDirByTarget(target)), new UnityEditorAssemblyResolver());
|
SettingsUtil.GetHotFixDllsOutputDirByTarget(target)),
|
||||||
|
new UnityPluginAssemblyResolver(),
|
||||||
|
new UnityEditorAssemblyResolver());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.focus-creative-games.hybridclr_unity",
|
"name": "com.focus-creative-games.hybridclr_unity",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"displayName": "HybridCLR",
|
"displayName": "HybridCLR",
|
||||||
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
|
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
|
||||||
"category": "Runtime",
|
"category": "Runtime",
|
||||||
|
|
Loading…
Reference in New Issue