Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. 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