2D network synchronizing

Zaffryn
edited April 2014 in DotNet
Good day,

I am experiencing a little problem with Photon Network. When i connect my client and my editor to the same Joined Room, nothing is synchronizing.[code2=csharp]using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour {


// Use this for initialization
void Start () {
Connect();
}

void Connect(){
PhotonNetwork.ConnectUsingSettings ("2DMulti V0.0.1");
}

void OnGUI(){

GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString());
}
void OnJoinedLobby(){

PhotonNetwork.JoinRandomRoom ();
}

void OnPhotonRandomJoinFailed(){
PhotonNetwork.CreateRoom (null);
Debug.Log ("createroom");

}

void OnJoinedRoom(){
SpawnMyPlayer ();
}

void SpawnMyPlayer(){

GameObject MyPlayerGO = (GameObject)PhotonNetwork.Instantiate ("MyPlayer", Vector3.zero, Quaternion.identity, 0);

((MonoBehaviour)MyPlayerGO.gameObject.GetComponentInChildren <PlayerMovement>()).enabled = true;
}
}[/code2]

And my PhotonView settings are :

Observe (transform MyPlayer)
Observe Option : Unreliable On Change
Serializadtion Position and Rotation

What am i doing wrong or what can I actually do to have everything sync?

Thank you

Comments

  • I just tried to reproduce this but it's not an issue with the 2D mode.
    I can instantiate and sync Sprites just fine.

    I can't see what type of object you instantiate.
    Do you have any errors in the log? Your connectionStateDetailed is "Joined"? Both players are in the same room? Do the instantiates work?

    If you somehow manage to apply input to a "remote" GameObject instance, then the input will be overruled by the position updates from remote (the other client is the owner).

    Make sure you instantiate a Prefab! The name of the prefab should not be in the scene, too.
  • Hi,

    i have included the screenshot of the settings i currently have

    To answer your questions :
    No errors in log
    connectionStateDetailed is Joined(If I start my editor before the client i get my debug message that createroom has been executed)
    My movement script works. when everything is running if i manually move my character in the scene view my client will have the change but when my movement script is executed on MyPlayer(Children) the change are not synchronising.
  • @Tobias hello can you please give the answer here which you have mention on given above link. there will be no solution and i really stuck at this point. please..
  • @JANESTHEKING: If you have a problem, please describe it in your own thread. Make sure we might know everything needed to help you.
  • Zaffryn said:

    Hi,



    i have included the screenshot of the settings i currently have



    To answer your questions :

    No errors in log

    connectionStateDetailed is Joined(If I start my editor before the client i get my debug message that createroom has been executed)

    My movement script works. when everything is running if i manually move my character in the scene view my client will have the change but when my movement script is executed on MyPlayer(Children) the change are not synchronising.

    make sure that whatever client is trying to give the movement, owns the object. For instance if the master client spanws the game object that you want the player to control. The master client is the only one allowed to change it.

    Same with the other way around, if the player spawned the object to the network, only his photon view can modify the object. So if you are trying to move the object with a movement script on a different client machine, then that could also be a problem.