1

I'm having some problems trying to create a plugin for Unity.

I have a simple plugin working that returns a string.

Now I want to have a socket.io connection from the plugin and I found a plugin called SocketIoClientDotNet. I have compiled mine to a .dll file and have it in my "Plugins" folder in my Unity project.

When I run the dll function from a Unity script I get the following error:

TypeLoadException: Could not load type 'Quobject.SocketIoClientDotNet.Client.IO' from assembly 'SocketIoClientDotNet, Version=0.9.10.0, Culture=neutral, PublicKeyToken=null'. myScript.Start () (at Assets/Scripts/myScript.cs:10)

This is my plugin:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Quobject.SocketIoClientDotNet.Client;

public class SocketPlugin
{
    public void Run()
    {
        var socket = IO.Socket("http://localhost");
    }
}

And my script in Unity:

using UnityEngine;
using System.Collections;

public class myScript : MonoBehaviour {

    public SocketPlugin plugin;

    void Start () {
        plugin = new SocketPlugin ();
        plugin.Run ();
    }
}

I've tried building the plugin with .NET 3.5, 4.0 and 4.5

Socket.IO plugin - https://github.com/Quobject/SocketIoClientDotNet/

Files in my Plugin folder:

  • sista.dll (my own dll)
  • SocketIoClientDotNet.dll
  • WebSocket4Net.dll
  • Newtonsoft.Json.dll
  • EngineIoClientDotNet

I've tried with and without the dll files and I get the same error. I have googled all day without any progress. So I really hope someone can give me some help on how I can fix this.

Max Yankov
  • 12,551
  • 12
  • 67
  • 135
Riggs
  • 13
  • 3

0 Answers0