Method group is Obsolete

NetworkWriter.Write

Switch to Manual
Obsolete public void Write (char value);
Obsolete public void Write (byte value);
Obsolete public void Write (sbyte value);
Obsolete public void Write (short value);
Obsolete public void Write (ushort value);
Obsolete public void Write (int value);
Obsolete public void Write (uint value);
Obsolete public void Write (long value);
Obsolete public void Write (ulong value);
Obsolete public void Write (float value);
Obsolete public void Write (double value);
Obsolete public void Write (Decimal value);
Obsolete public void Write (string value);
Obsolete public void Write (bool value);
Obsolete public void Write (byte[] buffer, int count);
Obsolete public void Write (byte[] buffer, int offset, int count);
Obsolete public void Write (Vector2 value);
Obsolete public void Write (Vector3 value);
Obsolete public void Write (Vector4 value);
Obsolete public void Write (Color value);
Obsolete public void Write (Color32 value);
Obsolete public void Write (GameObject value);
Obsolete public void Write (Quaternion value);
Obsolete public void Write (Rect value);
Obsolete public void Write (Plane value);
Obsolete public void Write (Ray value);
Obsolete public void Write (Matrix4x4 value);
Obsolete public void Write (MessageBase msg);
Obsolete public void Write (NetworkHash128 value);
Obsolete public void Write (NetworkIdentity value);
Obsolete public void Write (NetworkInstanceId value);
Obsolete public void Write (NetworkSceneId value);
Obsolete public void Write (Transform value);

Parameters

valueThe object to write.
bufferThe byte buffer to write.
countThe number of bytes in the byte buffer to write.
offsetThe byte buffer array element to start writing from.
msgThe network message to write.

Description

This writes a reference to an object, value, buffer or network message, together with a NetworkIdentity component to the stream.

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(); } }

See NetworkWriting for another code example.