PUN Basics Tutorial Issue

Options
Hello,

I did the pun tutorial on my own, and also used the already completed tutorial from in the unitypackage (free), and when i use the standalone and the editor to test it, 4 player prefabs are are loading in the Do not destroy on load method. Each player can move both characters. The two players with the Player UI on top are stationary and overlapping, while the two other players move around no matter from where I am controlling it.

Any assistance is appreciated, thanks.

I am using UNITY 2018

Comments

  • Hi @Iunami,

    sounds like there is a condition missing somewhere. Since you only test with two clients (Editor and Standalone) but have four objects in the scene, I would recommend taking a look at the PhotonNetwork.Instantiate call and check, if it is surrounded with the if (PlayerManager.LocalPlayerInstance == null) condition according to the tutorial. When you already look at this class, please also check, if the LocalPlayerInstance gets set properly. This is important because it prevents the game from instantiating a further object.

    For the movement please make sure, that it gets only processed on the Owner client. In the tutorial this is done with the following code snippet:
    if (photonView.IsMine == false && PhotonNetwork.IsConnected == true)
    {
        return;
    }
    This avoids processing the input on objects that the local client is not owning / controlling.
  • Iunami
    Iunami
    edited October 2018
    Options
    @Christian_Simon

    if (PlayerManager.LocalPlayerInstance==null) { Debug.LogFormat("We are Instantiating LocalPlayer from {0}", SceneManagerHelper.ActiveSceneName); // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate PhotonNetwork.Instantiate(this.playerPrefab.name, new Vector3(0f,5f,0f), Quaternion.identity, 0); }else{ Debug.LogFormat("Ignoring scene load for {0}", SceneManagerHelper.ActiveSceneName); }

    if( photonView.IsMine == false && PhotonNetwork.IsConnected == true ) { return; }

    These two are present in my code.

    I did just add a extra line after the Instantiate call.

    Debug.Log(PlayerManager.LocalPlayerInstance);

    I received a bunch of nulls. (Tried it in the update callback too to see if it takes a while to change).

    Sorry for the format, not sure how to edit it, buts it copy/paste whats in the Pun-Basics Code
  • Iunami
    Iunami
    edited October 2018
    Options
    I created a new project and the basic tutorial is working fine. Not sure what was wrong with the other one.

    Thanks for the assistance :smile: