Unity Script Error CS115 no suitable method found to override

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Unity Script Error CS115 no suitable method found to override

TomdieBratwurst
2022-04-16 15:11:43

Im makeing a multiplayer game using pun 2 I followed a tutorial but there is a error

Assets\LobbyManager.cs(111,26): error CS0115: 'LobbyManager.OnPlayerEnteredRoom(Player)': no suitable method found to override

Comments

TomdieBratwurst
2022-04-16 15:12:24

Here my code

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using Photon.Pun;

using Photon.Realtime;

using UnityEngine.UI;

public class LobbyManager : MonoBehaviourPunCallbacks

{

public InputField roomInputField;

public GameObject lobbyPanel;

public GameObject roomPanel;

public Text roomName;

public RoomItem roomItemPrefab;

List roomItemsList = new List();

public Transform contentObject;

public float timeBetweenUpdates = 1.5f;

float nextUpdateTime;

public List playerItemsList = new List();

public PlayerItem playerItemPrefab;

public Transform playerItemParent;

private void Start()

{

PhotonNetwork.JoinLobby();

}

public void OnClickCreate()

{

if (roomInputField.text.Length >= 1)

{

PhotonNetwork.CreateRoom(roomInputField.text, new RoomOptions() { MaxPlayers = 3 });

}

}

public override void OnJoinedRoom()

{

lobbyPanel.SetActive(false);

roomPanel.SetActive(true);

roomName.text = "Room Name: " + PhotonNetwork.CurrentRoom.Name;

UpdatePlayerList();

}

public override void OnRoomListUpdate(List roomList)

{

if (Time.time >= nextUpdateTime)

{

UpdateRoomList(roomList);

nextUpdateTime = Time.time + timeBetweenUpdates;

}

}

void UpdateRoomList(List list)

{

foreach (RoomItem item in roomItemsList)

{

Destroy(item.gameObject);

}

roomItemsList.Clear();

foreach (RoomInfo room in list)

{

RoomItem newRoom = Instantiate(roomItemPrefab, contentObject);

newRoom.SetRoomName(room.Name);

roomItemsList.Add(newRoom);

}

}

public void JoinRoom(string roomName)

{

PhotonNetwork.JoinRoom(roomName);

}

public void OnClickLeaveRoom()

{

PhotonNetwork.LeaveRoom();

}

public override void OnLeftRoom()

{

roomPanel.SetActive(false);

lobbyPanel.SetActive(true);

}

public override void OnConnectedToMaster()

{

PhotonNetwork.JoinLobby();

}

void UpdatePlayerList()

{

foreach (PlayerItem item in playerItemsList)

{

Destroy(item.gameObject);

}

playerItemsList.Clear();

foreach (KeyValuePair<int, Player> player in PhotonNetwork.CurrentRoom.Players)

{

PlayerItem newPlayerItem = Instantiate(playerItemPrefab, playerItemParent);

playerItemsList.Add(newPlayerItem);

}

}

public override void OnPlayerEnteredRoom(Player newPlayer)

{

UpdatePlayerList();

}

public override void OnPlayerLeftRoom(Player otherPlayer)

{

UpdatePlayerList();

}

}

devonlively
2022-04-16 18:15:53

its probably Onplayerenterroom. remove ed from entered.

Back to top