无法引用system.runtime unity

时间:2015-03-22 05:54:52

标签: c# unity3d reference

所以我正在编写一个与smartfoxserver统一的多人游戏,我试图构建一个脚本,将我的客户端连接到我的服务器,但我得到了错误:

"The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

这一行显示在public SmartFox _client;

我试图进入解决方案面板并添加对System.Runtime的引用,但我找不到它,我能找到的最接近的是System.Runtime.Serialization。

代码在下面粘贴,提前谢谢。

using UnityEngine;
using System.Collections;
using Sfs2X;
using Sfs2X.Core;
using Sfs2X.Requests;
using Sfs2X.Entities;

public class Client : MonoBehaviour {


private string host="localhost"; 
private int port= 9933; 


public SmartFox _client;

// Use this for initialization
void Start () {
    _client = new SmartFox ();
    _client.ThreadSafeMode = true;
    _client.AddEventListener (SFSEvent.CONNECTION, OnConnection);
    Connect();      
}

// Update is called once per frame
void FixedUpdate () {

    _client.ProcessEvents ();

}
public void Connect(){
    _client.Connect (host, port);
}

public void OnConnection(BaseEvent _event){
    if ((bool)_event.Params ["success"]) {
        Debug.Log("Successfully connected to server");

    } else { Debug.Log("Failed to connect to server")
        //failed

    }
}

}

1 个答案:

答案 0 :(得分:0)

尝试添加"使用System"文件顶部的声明。