This is the first tutorial I’ve watched in my six years of game development that I implemented in my own project without encountering any errors. I’ve never experienced that before! I loved that she explained each function of the code in detail. Thanks for the great tutorial!
Not all angels have wings, thanks for the effort, I have been stuck for a few days due to not having a clear tutorial on how to set up the GSH in your code, thanks again
thank you so much for this and the other tutorial. I really like the midsection explanations of concepts and the walk through of the code. this definitely is helping me understand and prepare for my final project.
Thank you!!! You are the best Unity teacher!😁 samyam's videos are always trustworthy. She provides systematic explanations based on her deep knowledge Thank you so~ much! It really helps. You are my lifesaver🤗
Thanks for the amazing tutorial. Are you using Netcode? Or you made your own custom server-clinet networking solution? I wanna make my own using websocket-sharp, by I dont know anything about hosting, scaling and pretty much anything else about hosting a backend server tbh.
quick question, anywhere you check "if IsServer", can i replace that with a scripting symbol like #if SERVER ? because i dont want the server code to ever be available on the client builds. If i understand correctly the pre-processor symbols will ignore the code if the condition isnt met and essentially omit it from the binary on build.
Hi! I am facing an issue, where when I want to make the copies join, I often (way too often) get failure, because of being RateLimited Even after checking the matchmaking ticket status every 5 seconds, not 1 second, I still get the same error, when using just two copies of the editor, I might hit a spot where they kind of sync their checking in propper time intervals and it doesnt throw an error. I am aware that the rate limitations say that one chceck should be done every second, but I don't see anyone in the tutorials, both yours and other creators facing the same issue. Do you have any idea what might cause this? Maybe I skipped something I'm really not sure and kind off helpless at this point (wasted over 10 hours already just for this issue)
I am having an issue where my two clients are not logging into the same server. I checked the logs and each server timed out on the backfilling. Any idea what I may have missed? I tried increasing the timeout time with no results :(
I'm trying to understand/estimate the billing on UGS. I remember once doing a tutorial on Amazon Web Services and was charged over $600 for one month because I wanted to take a course. I don't want a similar experience on UGS.
Amazing video, thanks so much for putting this together! I just joined the UGS team and used this as my onboarding, lol. I know it was long so I appreciate the effort you put into it :D Great stuff!
Could I ask you want when we modify script do we need to update the dedicated server too? If need do we have any solution to only update the change not entire script I always update 70mb all the time it spend so much time update only one change script.
Hi Samyam, I see you the video you are doing a great job and providing a good knowledge for Unity developers keep it up. But I have a question I am a student studying BSc game design and development I want to be a game programmer when I watch videos and learn to code I understand easily but when I try to do it myself it's going worst How can I deal with this please give me idea and suggestion for be a good game programmer thank you.
Practice practice practice! Problem solving is one of the most important skills for a programmer. Write out on a piece of paper the logic before starting to implement, visualize before diving into the programming it helps a lot
how can i delete the backfilling ticket of the player leaving the session in this?? and what does happens if it does not delete the backfilling ticket?
Hey Sam, great video everything works great, I'm using this with mirror, not a lot of changes other than how the port and Ip get assigned. Only issue I'm having is if there is only one game going, say you start a game and 2 players join and they successfully match in that one game, then one player dissconnects(quits), they do not get connected back to that one game, and no one trying to join, say a 3rd player can join that game once the max players is reached. So once max players is reached.. no one else can join that game at all.. might be in my conversion.. any thoughts? been working on a fix for a few hours now. EDIT: Finally figured it out, in order for a player to rejoin a server they have disconnected from, you need to remove them from the localticket, then update the ticket with matchmaker then resume backfilling for anyone having the same problem.
Do you have any code example of how you did this? I have a similar problem, I can't correctly call the ClientDisconnected() function because I'm using a mirror. So my matches are always being allocated giving the same error as you. Can you help me?
@@ChiefDev Sure, I'm calling this from a NetworkBehavior OnStopServer() on the player prefab and passing the player id as a parameter that is a sync var so the server knows the playerID. public async Task RemovePlayerFromMatch(string userID) { var playerToRemove = GetPlayerById(userID); if (playerToRemove == null) { Debug.LogWarning($"No user by the ID: {userID} in local backfill Data."); } _localBackfillTicket.Properties.MatchProperties.Players.Remove(playerToRemove); //We Only have one team in this game, so this simplifies things here _localBackfillTicket.Properties.MatchProperties.Teams[0].PlayerIds.Remove(userID); await MatchmakerService.Instance.UpdateBackfillTicketAsync(_localBackfillTicket.Id, _localBackfillTicket); ClientDisconnected(); } Then in ClientDisconnected() I changed to this public void ClientDisconnected() { if (!_backfilling && networkManager.numPlayers > 0 && NeedsPlayers()) { _ = StartBackfill(_matchmakingPayload); } }
samyam thank you for this tutorial! (it's clear the amount work you put into these) I was having this error on the FoodSpawner (Awake, OnEnable, and OnDisable) and the ConnectionApprovalHandler (Awake) "Object reference not set to an instance of an object". I figured it had to do with the client trying to run server code so I added this line *if (!NetworkManager.Singleton) return;* I don't get the error now but after the ticket gets assigned (I am able to see the success assignment log) nothing happens. I just get an empty screen on the client with the Length: 1 text at the bottom. But there's no player nor food on the screen. I can see the tickets being received and matched in the UGS console. Any ideas what I could be missing?
I'm seconding this question, I seem to be having the same issue! Seeing "NullReferenceException: Object reference not set to an instance of an object" in FoodSpawner.Awake(), FoodSpawner.OnDisable(), and ConnectionApprovalHandler.Awake().
Hi, did you make sure to follow the bug fixing section at 1:48:57 ? There's a couple of bugs I fix there. Let me know if that helps. If not feel free to elaborate exactly where you are having the error and/or post in our Discord (link in description)!
@@samyam Hello! I really thought I replied to this comment but it seems to have not gone through. I did go through the bug fixing section and reuploaded the bug-fixed build on UGS. I posted in the Discord as well, but the exact lines I'm having trouble with are NetworkManager.Singleton.OnServerStarted += SpawnFoodStart, NetworkManage.Singleton.OnClientConnectedCallback -= OnClientConnect, and NetworkManager.Singleton.ConnectionApprovalCallback += ApprovalCheck (in the three functions I mentioned in the last comment respectively). Is that helpful?
After the bug fixes, I corrected these issues making both an Awake and a Start for the FoodSpawner script, checking if it's the server in Awake before subscribing to OnServerStarted and, with a bool, checking if it was already done in Awake before doing the same in Start. Also I moved the content from OnEnable to Start and used the same line richard used before calling the content inside OnDisable.
Hey Samyam, which is better Unity Gaming Services Multiplayer or Netcode for GameObjects to dev a competitive multiplayer game 3vs3 per match with lobby and cosmetic itens Thank you for the tutorial
Netcode is the unity framework to allow multiplayer functionality in your game, UGS has features that help make multiplayer development easier such as voice chat and dedicated server hosting. You can have both in your project. If you wanted to upload to Steam you could use Netcode and a Steam transport (steamworks).
Hello Sam, What can I do if the server log at minute 30 says this: NullReferenceException: Object reference not set to an instance of an object at ServerStartUp.StartServer () [0x00005] in :0 at ServerStartUp.Start () [0x00052] in :0
using Unity.Services.Matchmaker does not exist in the current context. Am I missing a package download or something? I have verified I have the Matchmaker package.
I had the same issue. The problem is installing the matchmaker package from the package manager by searching it. You are looking for the Multiplayer Services package for both multiplay AND matchmaker
Would it be possible to run a game on windows or android while having the game uploaded on a Linux server build or would we have to wait for the windows server version instead of the Linux. I notice that you didnt change your build version while testing the game, so that is why I ask. I am working on a VR game and want to do a dedicated server build. If you dont want to answer, given your most recent video on unity, I understand. Thanks.
i think a main menu would just be a regular main menu, it shouldn't involve any multiplayer at all. So if you have a main menu, just have a section that goes into the server selection. That's probably how I would do it. However, I have pretty much no experience with multiplayer (I skimmed this vid and the previous one but I think i'll follow these vids as they seem really well made).
I am having a hard time figuring out the matching, what is the team replica setting? And I need 2 players in a team but both of them connect to 2 different allocations.
@@loghzpuzzle7837 Check the logs, after a lot of head banging we found a null reference in the server code that was forcing it to close accepting new connections. I hope yours is also solved.
Hey I followed the tutorial and it works fine for the main editor (the player and food spawn) but if I run the clone editor nothing spawns. It seems like I am receiving the request on Unity Services since I'm getting the matches so I am not sure why this could be happening. When I start the game the tickets were at 28 but jumped to 31 afterwards and matches went from 13 to 14. could this be caused by the increase on tickets ?
I fixed this issue by creating new clones. However, My new clones are not loading on to an already deployed server. Instead they are creating their own servers.
make sure you have these in the build config for the sever on UGS -ip $$ip$$ -port $$port$$ -queryport $$query_port$$ -logFile $$log_dir$$/Engine.log -dedicatedServer and to make sure you connecting to the right IP and Port through your code
I usually dont comment on videos but I followed everything but I still get a "Failed to connect to server" at the end. any tips on why this is happening?
Where it is failing? Put a breakpoint in your code to find out exactly where it’s failing and check the server logs. One small setting that’s off may cause it not to function properly
@@samyam Thanks, server seems to be running. clients have a hard time connecting. I even did it manually, like grab a server from my dashboard. turn it on. copy paste IP and port to my clients. still nada.
@@FriedRiceNietzche I'm having the same issue. I even started a blank project with almost 0 code in it to see if it was my code logic but I'm having the same issue. I'm guessing there is something I'm doing wrong with some setting that I have no clue about.
It can use any Transport, In the previous video I used Unity Netcode for Gameobjects and this video uses Unity Gaming Services Multiplayer for hosting and Matchmaker for matchmaking