public void StartMessage (short msgType);

Parameters

msgType 消息类型。

Description

此函数启用新消息,写入有效负载后,应使用 FinishMessage() 完成此消息。


using UnityEngine;
using UnityEngine.Networking;

public class ExampleScript : MonoBehaviour { void Start() { short myMsgType = 444;

NetworkWriter writer = new NetworkWriter(); writer.StartMessage(myMsgType); writer.Write("test data"); writer.FinishMessage(); NetworkClient myClient = new NetworkClient(); myClient.Send(writer, 0); } }