PUN2 OnConnectedToMaster() not called

Options

Hello everyone i currently have a project on PUN and i'm switching my project to PUN2.

So i finally correct all errors in my scripts but now i have problem to instantiate my player, and i can't call any fonction except ConnectUsingSettings() so here is my code :

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.UI;

using UnityStandardAssets.Utility;

using Photon;

using Photon.Pun;

using Photon.Realtime;

public class PUNScript : MonoBehaviourPunCallbacks

{

  public Text TxtInfos;

  public Transform SpawnPoint;

  public GameObject PrefabCharacter;

  public Camera MainCamera;

  private Health healthcharacter;

  private Image ForeGround;

  private bool HealthBarIsActivating = false;

  Health health;

void Start()

  {

    PhotonNetwork.ConnectUsingSettings();

    Debug.Log("USING SETTINGS");

  }


  public override void OnConnectedToMaster()

  {

    PhotonNetwork.JoinLobby();

    Debug.Log("MASTER");

  }


  public override void OnJoinRandomFailed(short returnCode, string message)

  {

    Debug.Log("TRIED TO JOIN A RANDOM GAME BUT FAILED");

    CreateRoom();

  }

  public void CreateRoom()

  {

    Debug.Log("CREATE ROOM");

    RoomOptions roomsOps = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 20 };

    PhotonNetwork.CreateRoom("server" + roomsOps);

  }


  public override void OnJoinedLobby()

  {

    Debug.Log("LOBBY JOINED");

  }


  public override void OnJoinedRoom()

  {

    Debug.Log("RoomJoined");

    StartCoroutine(SpawnMyPlayer());

  }

So i don't call any of these debug.log except the first one. If someone could help me that would be nice, thanks.

Comments