Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party MonoBehaviourPunCallbacks could not be loaded

Discussion in 'Multiplayer' started by Jeffery_Playz, Apr 16, 2023.

  1. Jeffery_Playz

    Jeffery_Playz

    Joined:
    Apr 2, 2023
    Posts:
    1
    Hi,
    I'm following a tutorial on creating multiplayer with Photon Pun and am getting an error saying that the associated script can't be loaded.

    This is my code:
    Code (CSharp):
    1. using Photon.Pun;
    2. using Photon.Realtime;
    3. using UnityEngine;
    4.  
    5. public class NetworkManager : MonoBehaviourPunCallbacks
    6. {
    7.     void Start()
    8.     {
    9.         ConnectToServer();
    10.     }
    11.  
    12.     void ConnectToServer()
    13.     {
    14.         PhotonNetwork.ConnectUsingSettings();
    15.         Debug.Log("Trying To Connect To Server...");
    16.     }
    17.  
    18.     public override void OnConnectedToMaster()
    19.     {
    20.         Debug.Log("Connected To Server.");
    21.         base.OnConnectedToMaster();
    22.         RoomOptions roomOptions = new RoomOptions();
    23.         roomOptions.MaxPlayers = 10;
    24.         roomOptions.IsVisible = true;
    25.         roomOptions.IsOpen = true;
    26.      
    27.         PhotonNetwork.JoinOrCreateRoom("Room 1", roomOptions, TypedLobby.Default);
    28.     }
    29.  
    30.     public override void OnJoinedRoom()
    31.     {
    32.         Debug.Log("Joined a Room");
    33.         base.OnJoinedRoom();
    34.     }
    35.  
    36.     public override void OnPlayerEnteredRoom(Player newPlayer)
    37.     {
    38.         Debug.Log("A new player joined the room");
    39.         base.OnPlayerEnteredRoom(newPlayer);
    40.     }
    41. }
    Any help would be much appreciated.
     
    Last edited: Apr 16, 2023