C# Unity3d ingame插件无法加载system32 dll
我正在为Kerbal太空计划(Windows8.1)开发插件,这样我就可以从游戏中使用zeroconf网络(你好)。我正在使用Mono.Zeroconf包装器,Bonjour已经安装并开始工作。简单的控制台应用程序工作正常,服务在网络上可见C# Unity3d ingame插件无法加载system32 dll,c#,dll,mono,unity3d,zeroconf,C#,Dll,Mono,Unity3d,Zeroconf,我正在为Kerbal太空计划(Windows8.1)开发插件,这样我就可以从游戏中使用zeroconf网络(你好)。我正在使用Mono.Zeroconf包装器,Bonjour已经安装并开始工作。简单的控制台应用程序工作正常,服务在网络上可见 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Mono.Ze
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mono.Zeroconf;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
RegisterService service = new RegisterService();
service.Name = "test server";
service.RegType = "_daap._tcp";
service.ReplyDomain = "local.";
service.Port = 6060;
// TxtRecords are optional
TxtRecord txt_record = new TxtRecord();
txt_record.Add("Password", "false");
service.TxtRecord = txt_record;
service.Register();
Console.WriteLine("Service registered!");
Console.ReadLine();
}
}
}
但当我将代码和DLL复制到Unity3d插件时,它无法加载Bonjour提供程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KSP;
using UnityEngine;
using Mono.Zeroconf;
namespace KSP_dnssdServer
{
[KSPAddon(KSPAddon.Startup.EveryScene, true)]
class dnssdServer: MonoBehaviour
{
private float lastUpdate = 0.0f;
private float lastFixedUpdate = 0.0f;
private float logInterval = 5.0f;
public RegisterService service;
public dnssdServer()
{
if (instance == null) {
instance = this;
Debug.Log("dnssdServer Started");
} else {
Debug.Log("dnssdServer already running, marking this instance as stale");
}
service = new RegisterService();
service.Name = "TestService";
service.RegType = "_ksp_dnssd._tcp";
service.ReplyDomain = "local.";
service.Port = 24321;
// TxtRecords are optional
TxtRecord txt_record = new TxtRecord();
txt_record.Add("Password", "false");
service.TxtRecord = txt_record;
service.Register();
Debug.Log("Service registered!");
GameObject.DontDestroyOnLoad(this);
}
/*
* Called after the scene is loaded.
*/
void Awake()
{
}
/*
* Called next.
*/
void Start()
{
}
/*
* Called every frame
*/
void Update()
{
}
/*
* Called at a fixed time interval determined by the physics time step.
*/
void FixedUpdate()
{
if ((Time.time - lastFixedUpdate) > logInterval)
{
lastFixedUpdate = Time.time;
Debug.Log(instance.GetInstanceID().ToString("X"));
}
}
void OnDestroy()
{
service.Dispose();
}
}
}
我假设从插件级加载System32DLL时有问题。你知道怎么解决这个问题吗?而答案是。。。Zeroconf DLL不应该像我在项目中看到的那样放在子文件夹中。在这种情况下,windows上的Mono.Zeroconf文件需要位于插件dll的旁边