PunTurnManager issue

Hey all,

apparently command BeginTurn() doesn't work for me.
public PunTurnManager turnManager;

void Start()
    {
        PV = GetComponent<PhotonView>();

        inputEnabled = false;
        this.turnManager = this.gameObject.AddComponent<PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        
        // duration of the turn
        turnManager.TurnDuration = 10f;

        if (RoomController.roomController.isGameLoaded)
        {
            GameBegins();
        }
    }

public void GameBegins()
    {
        Debug.Log("Game Started.");
        Debug.Log("Turn " + turnManager.Turn);
        if (PhotonNetwork.IsMasterClient)
        {
            turnManager.BeginTurn();
            Debug.Log(PhotonNetwork.CurrentRoom.GetTurn());
         }
    }
Last log results with "0"

What am i doing wrong?

Comments

  • Setting the turn is done via the server to make sure players are in sync. This means there is a slight delay between starting the turn and it being actually updated locally, due to a network roundtrip. The benefit is that basically the server is the authority and all clients get the turn event at about the same time (but definitely in the same order).

    Sorry for the delay in the answer.
  • MEH_Robson
    edited August 2020
    No problem at all.

    So how long should it take?
    Apparently when i put that Log into Update() it's still 0 after quite long time.

    TL3jdWY.png


    That's the error description:
    NotImplementedException: The method or operation is not implemented.
    Photon.Realtime.Room.SetTurn (System.Int32 v, System.Object p) (at Assets/Photon/PhotonRealtime/Code/Room.cs:64)
    Photon.Pun.UtilityScripts.PunTurnManager.set_Turn (System.Int32 value) (at Assets/Photon/PhotonUnityNetworking/UtilityScripts/TurnBased/PunTurnManager.cs:48)
    Photon.Pun.UtilityScripts.PunTurnManager.BeginTurn () (at Assets/Photon/PhotonUnityNetworking/UtilityScripts/TurnBased/PunTurnManager.cs:157)
    GameManager.GameBegins () (at Assets/Scripts/GameManager.cs:113)
    GameManager.Start () (at Assets/Scripts/GameManager.cs:48)
    
  • I checked the TurnManager in PUN 2.20.2 and your case seems to work OK.
    BeginTurn and SetTurn work fine in my case. I don't see how a NotImplementedException can happen. We just use simple C# extension methods here. Nothing special.

    Your code will run BeginTurn whenever Start() gets called. Make sure the client is already in the room.
  • MEH_Robson
    edited August 2020
    Yes, both clients are in room

    193FIoF.png

    I double checked with log in GameBegins() function in case for random disconnections through the way and there still 2 players in the room.
  • I think you may need to get rid of the errors I see there. Some may fire and then keep other code from executing.
    The NotImplemented exception is also something that should not be possible.

    Please update your PUN from the Asset Store again. Maybe something broke.
  • Finally resolved it.
    Somehow my GameManager.sc PhotonView manual observe didn't work and when i switched it to auto it started working.
    Thanks for all tips.