Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I reference the ServiceStack library in a Unity C# script?
    primarykey
    data
    text
    <p>I've got to make a Unity script to import and export some 3D models. I'm trying to reference Servicestack.Redis from my script so I can talk to redis. It compiles fine but unity won't load the library.</p> <p>I've copied the dll's from Build/Release/MonoDevelop/SericeStack.Redis.zip into my assets folder within unity, (is that correct?) I just got ServiceStack by cloning <a href="https://github.com/ServiceStack/ServiceStack.Redis" rel="nofollow">https://github.com/ServiceStack/ServiceStack.Redis</a></p> <p>When Unity attempts to load the script it says </p> <pre><code>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 &lt;filename unknown&gt;:0 at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in &lt;filename unknown&gt;:0 at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in &lt;filename unknown&gt;:0 at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in &lt;filename unknown&gt;:0 at Mono.CSharp.Driver.LoadReferences () [0x00000] in &lt;filename unknown&gt;:0 at Mono.CSharp.Driver.Compile () [0x00000] in &lt;filename unknown&gt;:0 at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in &lt;filename unknown&gt;:0 </code></pre> <p>My code so far is this. It's an editor script. It just makes a window with a button and when the button is clicked it attempts to connect to redis on localhost and get a key</p> <pre><code>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"); } } } </code></pre> <p>I'm probably just not referencing the library correctly. I'm fairly new to compiled languages.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload