【发布时间】:2014-07-30 21:54:55
【问题描述】:
我必须制作一个 Unity 脚本来导入和导出一些 3D 模型。我正在尝试从我的脚本中引用 Servicestack.Redis,以便我可以与 redis 交谈。它编译得很好,但统一不会加载库。
我已将 Build/Release/MonoDevelop/SericeStack.Redis.zip 中的 dll 复制到 unity 中的资产文件夹中,(对吗?)我刚刚通过克隆 https://github.com/ServiceStack/ServiceStack.Redis 获得了 ServiceStack
当 Unity 尝试加载脚本时,它会显示
Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
到目前为止,我的代码是这样的。这是一个编辑器脚本。它只是创建一个带有按钮的窗口,当单击该按钮时,它会尝试连接到 localhost 上的 redis 并获取密钥
using UnityEngine;
using UnityEditor;
using System.Collections;
using ServiceStack.Redis;
public class MyWindow : EditorWindow
{
// Add menu item named "My Window" to the Window menu
[MenuItem("Window/My Window")]
public static void ShowWindow()
{
//Show existing window instance. If one doesn't exist, make one.
EditorWindow.GetWindow(typeof(MyWindow));
}
void OnGUI()
{
if (GUILayout.Button("Press to Rotate"))
{
ProcessAsset();
}
}
void ProcessAsset()
{
using (var client = new RedisClient("localhost"))
{
client.Get ("hello");
}
}
}
我可能只是没有正确引用库。我对编译语言还很陌生。
【问题讨论】:
标签: unity3d servicestack