Version: 2018.4
LanguageEnglish
  • C#
Method group is Obsolete

NetworkWriter.Write

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

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

value The object to write.
buffer The byte buffer to write.
count The number of bytes in the byte buffer to write.
offset The byte buffer array element to start writing from.
msg The 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.