【发布时间】:2014-08-23 23:28:11
【问题描述】:
using UnityEngine;
using System.Collections;
public class Network1 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI() {
Debug.Log ("OnGUI()");
if (NetworkPeerType == NetworkPeerType.Disconnected){
if (GUI.Button (new Rect(10, 30, 120, 20), "Join a game")){
Network.Connect("127.0.0.1", 25001);
}
if (GUI.Button (new Rect(10, 50, 120, 20), "Host a game")){
Network.InitializeServer(32, 25001, false);
}
else if (Network.peerType == NetworkPeerType.Client){
GUI.Label(new Rect(10, 10, 300, 20), "Status: Connected as a Client");
if (GUI.Button (new Rect(10, 30, 120, 20), "Leave lobby")){
Network.Disconnect(200);
}
}
}
}
}
这是我的代码。它抛出这个错误:
Assets/Network1.cs(15,21):错误 CS0119:表达式表示 type', where avariable',value' ormethod 组是预期的
我已经用谷歌搜索了一段时间,但似乎无法获得相关答案。 任何帮助表示赞赏。
【问题讨论】:
标签: c# networking unity3d multiplayer