Hi Friends!
We working on unity3d.
The Game works fine.
All game logic calculates Master Client.
Any Client can be MasterClient, if masterClient was disconnected,
My problem apperars after reconnect to room!
The client, who was reconnected, on he's scene, units (mobs, creeps, soldiers) staying on position where they spawned at first time, it is doesn't matter when they spawned (before or after disconnect).
Then, someone spawn new units, they works fine, OnPhotonSerializeView() works correct.
I checked all params on units, all is ok ( in inspector debug mode too).
MasterClient's OnPhotonSerializeView() works,
but client's OnPhotonSerializeView() not calling.
And units, who stuck on wrong position, some time can resume normal activity. о.о
My code:
Anyone have some idea about this?
I checked all params on units, all is ok ( in inspector debug mode too).
4 days we can't resolve this problem
And sorry for my bad English
We working on unity3d.
The Game works fine.
All game logic calculates Master Client.
Any Client can be MasterClient, if masterClient was disconnected,
My problem apperars after reconnect to room!
The client, who was reconnected, on he's scene, units (mobs, creeps, soldiers) staying on position where they spawned at first time, it is doesn't matter when they spawned (before or after disconnect).
Then, someone spawn new units, they works fine, OnPhotonSerializeView() works correct.
I checked all params on units, all is ok ( in inspector debug mode too).
MasterClient's OnPhotonSerializeView() works,
but client's OnPhotonSerializeView() not calling.
And units, who stuck on wrong position, some time can resume normal activity. о.о
My code:
public class MobSerializationNetwork : Photon.MonoBehaviour {
void Start() {
m_MobScript = GetComponent<Mob>();
m_Transform = transform;
m_CorrectPlayerPos = m_Transform.position;
m_MobScript.photonView.ObservedComponents.Clear();
m_MobScript.photonView.ObservedComponents.Add(this);
m_MobScript.photonView.synchronization = ViewSynchronization.ReliableDeltaCompressed;
if (m_MobScript.photonView.RpcMonoBehaviours == null) {
RestartSerialization();
} else if (m_MobScript.photonView.RpcMonoBehaviours.Length == 0 ) {
RestartSerialization();
}
}
public void RestartSerialization() {
m_MobScript.photonView.RefreshRpcMonoBehaviourCache();
}
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
// Debug.Log("i'm working");
if (stream.isWriting) {
stream.SendNext((short)m_MobScript.lookDirection);
stream.SendNext((byte)m_MobScript.animState);
stream.SendNext((Vector2)m_Transform.position);
}
else {
m_MobScript.lookDirection = (short)stream.ReceiveNext();
m_MobScript.animState = (AnimState)((byte)stream.ReceiveNext());
m_CorrectPlayerPos = (Vector2)stream.ReceiveNext();
syncTime = 0f;
syncDelay = Time.time - lastSynchronizationTime;
lastSynchronizationTime = Time.time;
}
}
void Update() {
if (!PhotonNetwork.isMasterClient) {
syncTime += Time.deltaTime;
m_Transform.position = Vector3.Lerp(m_Transform.position, m_CorrectPlayerPos, syncTime / syncDelay);
}
}
}
Units spawns by PhotonNetwork.InstantiateSceneObject(...);
Anyone have some idea about this?
I checked all params on units, all is ok ( in inspector debug mode too).
4 days we can't resolve this problem

And sorry for my bad English
