Photon 2 migration bugs
Options
Hello i was trying to update to photon 1 to photon 2.
But i get these errors
But i get these errors
error CS0103: The name 'AllPlayer' does not exist in the current context error CS0103: The name 'roomList' does not exist in the current context error CS0119: 'RoomInfo' is a type, which is not valid in the given context error CS0305: Using the generic type 'List<T>' requires 1 type arguments error CS0023: Operator '.' cannot be applied to operand of type 'void' error CS0103: The name 'roomList' does not exist in the current context error CS0119: 'RoomInfo' is a type, which is not valid in the given context error CS0305: Using the generic type 'List<T>' requires 1 type arguments error CS0103: The name 'ConnectionState' does not exist in the current context error CS0117: 'PhotonNetwork' does not contain a definition for 'connectionState' error CS0103: The name 'ConnectionState' does not exist in the current context error CS0117: 'PhotonNetwork' does not contain a definition for 'connectionState' error CS0103: The name 'ConnectionState' does not exist in the current context error CS0117: 'PhotonNetwork' does not contain a definition for 'ConnectionState' error CS0103: The name 'roomList' does not exist in the current context error CS0119: 'RoomInfo' is a type, which is not valid in the given context error CS0305: Using the generic type 'List<T>' requires 1 type argumentsThe script of where i get the errors.
allPlayersTeamSurvivor.Add(AllPlayer); allRooms = ILobbyCallbacks.OnRoomListUpdate(List < RoomInfo > roomList); if (PhotonNetwork.IsConnected && allRooms.Length != ILobbyCallbacks.OnRoomListUpdate(List < RoomInfo > roomList).Length) if (PhotonNetwork.ConnectionState != ConnectionState.Connecting && PhotonNetwork.connectionState != ConnectionState.InitializingApplication && PhotonNetwork.connectionState != ConnectionState.Disconnecting) allRooms = ILobbyCallbacks.OnRoomListUpdate(List < RoomInfo > roomList);
0
Comments
-
Please i need help cause my connect menu script doesnt show anymore please help.0
-
Hi @Federico123,
Most of things that need to be changed are listed on the "Migration Notes" page.
I see three different issues in your code:
1. Usage of OnRoomListUpdate callback. See Asteroids demo or check the forum for how to replace PhotonNetwork.GetRoomList.
2. PhotonNetwork.ConnectionState is replaced with PhotonNetwork.NetworkClientState. ConnectionState enum is replaced with ClientState enum.
3. AllPlayer field or property, I'm not sure this is from PUN Classic, so can't help you with this.0 -
Hi @Federico123,
3. AllPlayer field or property, I'm not sure this is from PUN Classic, so can't help you with this.
I don't know how but it worked on pun classic but in pun 2 it doesnt0 -
Hi @Federico123,
3. could you share code of the definition of AllPlayer, which class it belongs to? etc.0 -
Hi @Federico123,
3. could you share code of the definition of AllPlayer, which class it belongs to? etc.
Hi AllPlayer Belongs to another script which is roommultiplayermenu.
If you want it here.void FixedUpdate() { if (isPaused || gameMode == "ZOM") { allPlayers.Clear(); Photon.Realtime.Player[] array = PhotonNetwork.PlayerList; foreach (Photon.Realtime.Player item in array) { allPlayers.Add(item); } if (allPlayers != null && gameMode == "ZOM") { allPlayersTeamSurvivor = new List<Photon.Realtime.Player>(); foreach (Photon.Realtime.Player allPlayer in allPlayers) { if ((string)allPlayer.CustomProperties["TeamName"] != team_zombie.teamName) { // allPlayersTeamSurvivor.Add(AllPlayer); } } allPlayersTeamSurvivor.Sort(SortPlayers); if (allPlayersTeamSurvivor.Count > 0) { leadingPlayer = allPlayersTeamSurvivor[0].NickName; } else { leadingPlayer = string.Empty; } if (PhotonNetwork.IsMasterClient && !waitingForPlayers && allPlayersTeamSurvivor.Count == PhotonNetwork.PlayerList.Length) { notimer += 1f * Time.deltaTime; if (notimer > 5f) { base.photonView.RPC("Infect", PhotonNetwork.LocalPlayer); } if (!PhotonNetwork.IsMasterClient || !(gameMode == "ZOM") || waitingForPlayers) { return; } if (allPlayersTeamZombie.Count == 0 && !Escapesuccess) { checkescapeorno += 1f * Time.deltaTime; if (checkescapeorno > 3f) { checkZombieWin(); } } else { checkescapeorno = 0f; } if (allPlayersTeamSurvivor.Count == 0 && !Escapefail) { checkescapeorno += 1f * Time.deltaTime; if (checkescapeorno > 3f) { checkZombieWin(); } } else { checkescapeorno = 0f; } } } }
I put the line in //0 -
Hi @Federico123,
3. could you share code of the definition of AllPlayer, which class it belongs to? etc.
Also i get this.
The lobby keeps connecting and the gui is broken, when it was in pun classic it didnt break.NullReferenceException: Object reference not set to an instance of an object UnityEngine.GUI.DoTextField (UnityEngine.Rect position, System.Int32 id, UnityEngine.GUIContent content, System.Boolean multiline, System.Int32 maxLength, UnityEngine.GUIStyle style, System.String secureText, System.Char maskChar) (at <817eebdd70f8402280b9cb11fff8b976>:0) UnityEngine.GUI.DoTextField (UnityEngine.Rect position, System.Int32 id, UnityEngine.GUIContent content, System.Boolean multiline, System.Int32 maxLength, UnityEngine.GUIStyle style, System.String secureText) (at <817eebdd70f8402280b9cb11fff8b976>:0) UnityEngine.GUI.DoTextField (UnityEngine.Rect position, System.Int32 id, UnityEngine.GUIContent content, System.Boolean multiline, System.Int32 maxLength, UnityEngine.GUIStyle style) (at <817eebdd70f8402280b9cb11fff8b976>:0) UnityEngine.GUILayout.DoTextField (System.String text, System.Int32 maxLength, System.Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <817eebdd70f8402280b9cb11fff8b976>:0) UnityEngine.GUILayout.TextField (System.String text, System.Int32 maxLength, UnityEngine.GUILayoutOption[] options) (at <817eebdd70f8402280b9cb11fff8b976>:0) ConnectMenu.ShowConnectMenu () (at Assets/Resources/_Scripts/important scripts/ConnectMenu.cs:198) ConnectMenu.OnGUI () (at Assets/Resources/_Scripts/important scripts/ConnectMenu.cs:146) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
GUILayout.BeginArea(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 150, 500, 330), "", GUI.skin.GetStyle("window")); ShowConnectMenu(); GUILayout.EndArea();
playerName = GUILayout.TextField(playerName, 15, GUILayout.Height(25));
0 -
@JohnTube
My game wont connect to photon it just says PeerCreated.0 -
how do you connect?
do you use a method other than ConnectUsingSettings?0