Class StringMessage
This is a utility class for simple network messages that contain only a string.
This example sends a message with the name of the scene.
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.NetworkSystem;
public class Test
{
void SendSceneName(string sceneName)
{
var msg = new StringMessage(sceneName);
NetworkServer.SendToAll(MsgType.Scene, msg);
}
}
Inheritance
StringMessage
Syntax
[Obsolete("The high level API classes are deprecated and will be removed in the future.")]
public class StringMessage : MessageBase
Constructors
StringMessage()
Declaration
StringMessage(String)
Declaration
public StringMessage(string v)
Parameters
Type |
Name |
Description |
String |
v |
|
Fields
value
The string that will be serialized.
Declaration
Field Value
Methods
Deserialize(NetworkReader)
Declaration
public override void Deserialize(NetworkReader reader)
Parameters
Overrides
Serialize(NetworkWriter)
Declaration
public override void Serialize(NetworkWriter writer)
Parameters
Overrides