I did everything as on YouTube or similar sites, but this code still does not work. It doesn’t work at all. The X field is not synchronized.
Photon View is configured correctly (watched YouTube).
c.Rep(x) - Displays the value of X in the console, which I made inside the game.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class Test : MonoBehaviourPunCallbacks, IPunObservable
{
public Console c;
[SerializeField]
string x;
public InputField f;
public void tt()
{
x = f.text;
c.Rep(x);
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if(stream.IsWriting)
{
stream.SendNext(x);
}
else
{
x = (string) stream.ReceiveNext();
}
}
}