Quantcast
Channel: Questions in topic: "online game"
Viewing all articles
Browse latest Browse all 36

Multiplayer Photon/Pun Issues

$
0
0
**Hello! I have been working on making an online game with Photon/Pun 2. I have been following the tutorials on https://weeklyhow.com/how-to-display-rooms-in-the-lobby-unity-v2019-1-1f1-pun-2/ but have run into some scripting errors. First, I would like to say that I have completed the building the Lobby section of this (references in site). Anyway, the script errors are on the LobbyGameNetwork.cs** and the CreateNewRoom.cs scripts. The errors/warnings I'm getting are as follows: - *Assets\MadeScripts\LobbyGameNetwork.cs(35,13): error CS0103: The name 'CanvasManager' does not exist in the current context.* **This error was for the LobbyGameNetwork.cs script. It won't let me even play. The other two are warnings from the CreateNewRoom.cs script. They are:** - *There are inconsistent line endings in the 'Assets/MadeScripts/CreateNewRoom.cs' script. Some are Mac OS X (UNIX) and some are Windows. This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands. UnityEditor.AssetDatabase:Refresh() SyntaxTree.VisualStudio.Unity.Bridge.<>c:b__11_0() SyntaxTree.VisualStudio.Unity.Bridge.<>c__DisplayClass40_0:b__0() UnityEditor.EditorApplication:Internal_CallUpdateFunctions()* **and** - *Assets\MadeScripts\CreateNewRoom.cs(9,18): warning CS0649: Field 'CreateNewRoom._roomName' is never assigned to, and will always have its default value null* **This is a very annoying problem. The LobbyGameNetwork.cs script won't let me play, and the CreateNewRoom.cs script won't let me put it into the UI. I'm very inexperienced with network stuff, so I really need help. I will also include my scene file soon. The scripts are in my folder: Assets/MadeScripts.** **Ok so here's an update. I decided to TRY to complete the tutorial even with the errors. It turned out that that error was a thing in a different script that I hadn't made yet. It also fixed my warnings. Unfortunately, even though I've completed the course, it gives me a NEW error on a different script. Here's the script with the error. I put "ERROR ZONE" in bold in the area that I have problems. Error in console is at the end.** - public class RoomListDisplay : MonoBehaviourPunCallbacks { [SerializeField] private GameObject _roomPrefab; private GameObject RoomPrefab { get { return _roomPrefab; } } private List _roomListButtons = new List(); private List RoomListButtons { get { return **ERROR ZONE**_roomListingButtons;**ERROR ZONE END** } } public override void OnRoomListUpdate(List roomList) { foreach (RoomInfo room in roomList) { RoomReceived(room); } RemoveOldRooms(); } private void RoomReceived(RoomInfo room) { int index = RoomListButtons.FindIndex(x => x.RoomName == room.Name); if (index == -1) { if (room.IsVisible && room.PlayerCount < room.MaxPlayers) { GameObject roomListingObj = Instantiate(RoomPrefab); roomListingObj.transform.SetParent(transform, false); RoomList roomListing = roomListingObj.GetComponent(); RoomListButtons.Add(roomListing); index = (RoomListButtons.Count - 1); } } if (index != -1) { RoomList roomListing = RoomListButtons[index]; roomListing.SetRoomNameText(room.Name); roomListing.Updated = true; } } [PunRPC] public void RemoveOldRooms() { List removeRooms = new List(); foreach (RoomList roomListing in RoomListButtons) { if (!roomListing.Updated) { removeRooms.Add(roomListing); } else { roomListing.Updated = false; } } foreach (RoomList roomListing in removeRooms) { GameObject roomListingObj = roomListing.gameObject; RoomListButtons.Remove(roomListing); Destroy(roomListingObj); Debug.Log(roomListingObj.name + " is Destroyed"); } } } **Here's the error I'm getting:** - Assets\MadeScripts\RoomListDisplay.cs(18,22): error CS0103: The name '_roomListingButtons' does not exist in the current context **By the way, the script finder is trash.**

Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>