Serialize the text

Greetings fellows! Is it possible to serialize the string value? Currently, I have a script working all right if 2 variables are integer or float, but it shows error, once I change data type to string.

using UnityEngine;
using System.Collections;

public class serializeee : MonoBehaviour {

	public string text1 = "This is text 1";
	public string text2 = "This is text 2";

	void Update () {
	}

	void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) {
		if (stream.isWriting) {
			text1 = text2;
			stream.Serialize(ref text1);
		} else {
			stream.Serialize(ref text1);
			text2 = text1;
		}
	}
}

Could you please suggest what is wrong and how to fix it?


Thanks!

Supported types are: bool, char, short, int, float, Quaternion, Vector3 and NetworkPlayer.

Via BitStream.Serialize

Thanks, but it is said here: Unity - Manual: Script serialization that “primitive data types (int, float, double, bool, string, etc.)” can be serialized. Or am I wrong?