What I reccomend for ur clips to use diffrent workflow or order when u record this tutorials, first show us UI then code. This way u keeping trowing new files and scipts, but when u create it I do not know why do u need that new script, so script doesnt make sense until I see UI and then I need to scroll through scipts again to understand why I wrote some methods. In this alternative I will understand it first time, while I am writting code. But thank u for ur work anyway, keep going :D
I second this because our UI is usually different from your UI and it's better to know in advance what parts of your code we should ignore and it's also really confusing when you mention all these different scripts but we don't even have a visual representation yet of why we are doing it this way, this does cause us to have to jump back and forth a lot. Thanks for these excellent tutorials, hope you don't mind our feedback.
BIG thank you to stefan429, he is right, well the things he mentioned in his comment: if youre having issues, MAKE SURE: 1. your networkManager has the roomPlayer prefab assigned at the bottom 2. youre using path instead of name for checking the active scene in both OnServerConnect AND OnServerAddPlayer in NetworkManagerLobby, i.e. SceneManager.GetActiveScene().path so for number 2, in detail, in the youtube tutorial, it shows: if(SceneManager.GetActiveScene().name != menuScene) { conn.Disconnect(); return; } BUT you need to change it to: if(SceneManager.GetActiveScene().path != menuScene) { conn.Disconnect(); return; } that fixed the problem... ONE LAST thing i am trying to figure out, is my lobby, the Roomplayer prefabs never show up on the Left side that shows the tree and the objects... not sure why :(
@@meddjihed9108 If you have the bug where Roomplayer doesn't get instanciated: NetworkManagerLobby.menuScene doesn't get converted to the rigth string, so if (SceneManager.GetActiveScene().name == menuScene) won't be true. Fix this by making [SerializeField] string menuScene; And type in the scene name in the inspector instead of dragging in the scene. Used Unity 2020.1.6f1 Credit:- @Julian Röckl
public void SetPlayerName(string name) { continueButton.interactable = !string.IsNullOrEmpty(name); } this line of code is broken for no reason. But it got fixed with public void SetPlayerName(string name) { continueButton.interactable = nameInputField.text.Length >= 4; } I do not know why it got fixed
If you have the bug where Roomplayer doesn't get instanciated: NetworkManagerLobby.menuScene doesn't get converted to the rigth string, so if (SceneManager.GetActiveScene().name == menuScene) won't be true. Fix this by making [SerializeField] string menuScene; And type in the scene name in the inspector instead of dragging in the scene. Used Unity 2020.1.6f1
Its a really good tutorial but you should explain more thoroughly or go slower , i was stuck trying to figure out why my intelisense would not recognize the event action bit and in the end i realized is because i was missing using system. But overall a really great tutorial man.
Make sure you check out the project in github too - that's how I fixed all my missed imports that were throwing errors :) my ide is awful at picking up intellisense haha
I'm following your wonderful series (which you said it is not a series ahahah), anyways, is there the possibility to create multiple lobbies contemporarily to which the users can connect by a name or an ID? I mean private lobbies for groups of people
Would love some help - My unity player launches the lobby fine when I host, when I join the localhost on the build version it joins but all it says is "Lobby Tutorial" it doesn't create another player. I'm not getting any errors. Thoughts?
Guys help me, my "Empty" object is not spawning, and neither is the "NetworkGamePlayerLobby" prefab. It's all set right in NetworkManager. if anyone knows please help me.
I get a little lost, trying to figure out what code we are supposed to create, and what code comes with Mirror. I definitely love it when you show us your screen while you type it out. Either way it is a great tutorial, and definitely helps us create a network lobby without any experience. Thank you!
[Solved] it seems like everything with the connection and UI works, but i cant see the roomplayer objects. yes i assigned them in the inspector of the network manager Edit: i wrote the Function for the Host not for the client xD
thanks for the great tut! I'm having a really weird issue, where i am trying to override methods from the NetworkManager but it says that no suitable method can be found. I swear I'm inheriting from the base class correctly
Okay, I solved the problem for anyone who might be interested, the problem was that i had another package installed (called rasa, a chatbot framework) which also had a class called NetworkManager which I was inheriting from. Oops
It would appear there is no function called OnClientConnect() in the class NetworkBehaviour. Has it been removed in some update since this video, or has it changed name?
Whenever I join lobby on my remote build after hosting a lobby it connects, creates player, than instantly disconnects. It goes onEnable, joinLobby, onStartClient, onClientConnect, handleClientConnected, onDisable, onClientDisconnect. Did anyone have a similar issue?
Having the same issue, has anybody found a solution to this problem? The roomplayer gets instantiated on host but as when I go to join on a different computer the OnServerAddPlayer() method is not even called, I then am promptly disconnected.
@@Imdad6629 I have solved the problem with me hope it can help you and also the others if someone has the same problem. so go to the game object "NetworkManager" where you also have the NetworkManagerLobby script on it, with me has there always automatically created the Kcp transport that's wrong delet it. search for "Telepathy Transport" at component and link it in the inspector in the NetworkManagerLobby script.(my english is not so good i hope it helps u out :)
After following this video and the next one in the playlist, I'm having trouble connecting a client to the host. I've ensure the transport IP is localhost, but still no results. If it helps, the logs show the host accepting the connection and then the client immediately disconnects. On the flip side when running a client in editor and attempting to join the lobby by specifying "localhost", the only message that appears is a timeout message. Any ideas what could be going on here?
I actually solved the issue on my own after taking a break and coming back to this. The menuScene variable doesn't store the correct value. I simply hard-coded it to the value of "Scene_Lobby" to get it to work. Hope this helps anyone who might be having this problem!
This is a lovely tutorial! It really helped me get started in building a LAN lobby, and saved me hours of time and headache ! However.. I was wondering if it was possible to connect using a room name instead? Something like substituting the IP address with the room name when the lobby is created I am having trouble doing that and the system can only recognise the network address being changed locally, while the network address of the host is something like 'my room', in the client, it registers as 'localhost' still.. Any help would be much appreciated, I've spent so much time trying to figure this out and am unable to do much about it >
Sure, but you need a backend solution for that. It should store map with ip_address => room_name and when user sends room name to server, it should resolve it with ip address.
@@littledumpling5614 Hello! I used another method, so if you're looking for how to do something similar to what I wanted to using the localhost method, I'm afraid I can't help you. If you'd like to know the other method however, I'll explain a bit about it! So rather than have my players input the IP or localhost, I decided to use Network Discovery instead. Basically, NetworkDiscovery, upon starting a local host, will advertise it as a server, so all clients will be able to see it when they look for a server, and will then be able to join it! It's also possible to display a list of servers active, I didn't do it for my project because it isn't needed. The built-in script does make that work though, so I recommend experimenting with it. Here's what I used to get started: mirror-networking.com/docs/Components/NetworkDiscovery.html?q=network%20discovery All the best!
I'm getting a 'no suitable method found to override' error for both the OnServerAddPlayer method and the OnServerConnect method. Any solution? thanks in advance :)
me too, I'm also having that issue: [EDIT] Found out why and how to fix it: change "public override void OnServerDisconnect(NetworkConnection conn)" to "public override void OnServerConnect(NetworkConnectionToClient conn)"
Thanks for the tutorial! One question though. In the "OnServerAddPlayer" function, why did you instantiate the roomplayerprefab instead of a player prefab. Is there a reason for this?
@@A_Reaper23 The reason is, I guess, this script is only making players join the Lobby Room and not the Game itself. Things like PV, Mana and else that we could need in game won't be usefull in lobby so we can use different prefabs. (I hope you did find your answer before but just in case you didn't ... ;) )
When I click host the player prefab spawns which is great! Though when I go to click join with the other client I get a timeout. Using localhost and such, I am unsure where I went wrong. Been looking through all day for a solution. Hopefully I will come across something.
Guys I found the problem, since I had the same ^^ using [Scene] [SerializeField] private string menuScene; results the string being "your current path to the assets folder + path to your scene + scene name". Now in the OnServerConnect method we check if the client tries to join an ongoing game, where we check if(SceneManager.GetActiveScene().name != menuScene). That results in checking the hole path string against just the scene name. So the Client gets disconnected immediately and the roomPlayer doesnt gets instantiated. If you fix the string menuScene, to only contain the actual scene name, it will work properly ! :D
@@Frenuellcrackser33 i now get a error saying the object i want to instantiate is null, i've bene looking for a while but cant find a answer, would you be able to point me in the right direction? also thanks for the previous fix :) the error is with the instantiation of roomplayerprefab in Networkmanager
@@broForseNetwork make sure that rhe RoomPlayer Prefab is referenced in the NetworkManager(Lobby) script in your scene. For the Player Prefab aswell as the Room Player Prefab.
Hey Dapper Dino ^^ I really appreciate these tutorials! I learn a lot from you and it's great. I've looked at the Mirror documentation because I really want to be able to name my lobby, your tutorial showed how to connect directly via. IP address, but if I want a server list, surely I would also want names for servers. Could you perhaps show how to do that? I've looked around the internet for days and can't find anything. Thank you in advance :) To clarify, what i mean is how to name a server when creating it, I can only find StartHost() and StartServer() where none of them takes a parameter.
A server browser needs a dedicated matchmaking system which you'd permanently host on a separate server. Steamworks is your best bet though you can use others.
I also had the problem where the RoomPlayers weren't showing in the Hierarchy after players were joined. To fix this I had to update the OnClientConnect / OnClientDisconnect functions in NetworkManagerLobby.cs: public override void OnClientConnect() { base.OnClientConnect(); OnClientConnected?.Invoke(); } public override void OnClientDisconnect() { base.OnClientDisconnect(); OnClientDisconnected?.Invoke(); }
Hey Its possible for you to make a tutorial about syncing Mirror + Fizzy + Steamwork ? I use Steamwork complete V2 with Mirror and FizzySteam , I follow your tutorial , But I don't understand how to link correctly my networkManager and my LobbyManager from Steamwork. :/
I did this, but my Roomplayer prefab doesn't create, but he is in the network manager as player prefab and player room prefab, what could i have done wrong? Edit: i found it for some reason my MenuScene string does not work so i needed to hardcode it like this == "Lobby"
Hey there Victor, I had the same problem, i fixed it by replacing all accurances of SceneManager.GetActiveScene().name with SceneManager.GetActiveScene().path and that fixed it for me. Also that way you avoid using hardcoded strings inside code, like your "Lobby" string for example.
when i enter the ip address it doesn't take me into the lobby. and it comes with the error "could not resolve the host" and then after that it would say whatever name i have put in
Spawning in the registered prefabs doesnt work for me- every time it throws me this message- Replacing existing prefab with assetId '[assetId of Prefab]'. Old prefab 'RoomPlayer', New prefab 'RoomPlayer' UnityEngine.Logger:Log(LogType, Object) Any help here? i'm really stuck on this.
Search for the Mirror Component NetworkDiscovery. With that you can Broadcast your server on lan (AdvertiseServer) and also search for available Servers
PlayerPrefs is volatile right. It's only accessible till the app cache is uncleared. When the player clears the cache then the data saved is gone right?
NetworkManagerLobby.OnClientConnect(NetworkConnection)': no suitable method found to override NetworkManagerLobby.OnClientDisconnect(NetworkConnection)': no suitable method found to override
Hi, I'm also having the same button issue. I noticed that I could press it once before i put any text into the Inputfield but then once I did, every time i ran the game after that I was unable to press the confirm button. :( EDIT: G Chozick has a method that fixed it for me. When you on the "InputField_Name" you change the OnValueChanged from a static to dynamic.
@@kyleweeks761 late reply but: put name = nameInputField.text; before the continuebutton line in SetPlayerName the name string is actually not linked in any way to the input field in the original code which is why it will always return true to the isnullorempty and the button will always be noninteractable
No, It's using a networking solution called Mirror. He has another video where he shows you how to set it up, and the thumbnail is a multiplayer remake of pong. Hope this helped!
Client Recv: failed to connect to ip=localhost port=7777 reason=System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it. at System.Net.Sockets.TcpClient.Connect (System.String hostname, System.Int32 port) [0x0019d] in :0 at Telepathy.Client.ReceiveThreadFunction (System.String ip, System.Int32 port) [0x00002] in C:\Users\Anca\Documents\AR\ar1\Assets\Mirror\Runtime\Transport\Telepathy\Client.cs:54 UnityEngine.Debug:LogError(Object) Telepathy.Client:ReceiveThreadFunction(String, Int32) (at Assets/Mirror/Runtime/Transport/Telepathy/Client.cs:74) Telepathy.c__DisplayClass11_0:b__0() (at Assets/Mirror/Runtime/Transport/Telepathy/Client.cs:157) System.Threading.ThreadHelper:ThreadStart() Anyone knows what is this? This appears right after I click on 'Join Lobby'
for some reason the continue button on the external build doesn't enable when i type my name. but when i test it in unity itself it works fine. any suggestions what causes this issue?
Your tutorial is awesome ..! I've got a question. what if i want to connect to my friend's game but i use different network connection. So what should i do?
its in the mirror tutorial section of Dapper Dino's github. He didnt have seperate gits for each video, so the git you see is the completed version after following all the tutorials in this playlist
Hey one question does this work also by remote or only for local clients? Btw those tutorials are really cool. Also i'm having a problem whith the input field that doesn't work: when i click on it nothing happens
You can either look up how to port-forward for your router or look into using stream as a relay: ua-cam.com/video/QlbBC07dqnE/v-deo.html&ab_channel=DapperDino
Hey Dapper sorry if i take your time with those questions but i would like to know if you already did a video about interracting with objects or spawn objects or other similar things in a multiplayer game. Sorry again
He uses the namespaces to organize things. Don't copy the entire files over if you don't want to type the methods up yourself. Take only the class and the includes.
what are these errors i just copied everything lol, 1. Assets\Lobby Scene\Scripts\NetworkManagerLobby.cs(19,34): error CS0246: The type or namespace name 'NetworkGamePlayerLobby' could not be found (are you missing a using directive or an assembly reference?) 2. Assets\Lobby Scene\Scripts\NetworkManagerLobby.cs(27,21): error CS0246: The type or namespace name 'NetworkGamePlayerLobby' could not be found (are you missing a using directive or an assembly reference?) edit: I cant Also find Network Identity and all scripts i have them but i cant drag them to RoomPlayer???
Hi, iam facing collision detecting issue with raycast in addtitive scene in multiplayer game. player not able to detect other objects in additive scene but on mainscene it works.Can anyone help me with this fix?
I really hope I didn't miss anything, but for some reason it doesn't allow me to click in the Input Field in the first place. Does anyone know what could be the problem??
Im pretty sure its not supposed to happen, but when I test it out, it crashes the game. Im not sure where I went wrong, becuase it doesn't really give a reason why
Tags for ctrl+f users: "Cant" "Connect" "Join" "Instantiate" "Room" "Player" "Prefab" SOLUTION FOR CANT CONNECT WITH JOIN BUTTON I dont know why but as its like that in NetworkManager, StartClient() function should be above of "networkAdress = ipAdress" line. This fixed my problem that "Join button wasnt working." So shortly replace JoinLobby with this: public void JoinLobby() { string ipAdress = ipAdressInputFieldText.text; networkManager.StartClient(); networkManager.networkAddress = ipAdress; }
hi, i have a strange issue, when client join i can see in server the new prefab, but it's created over the prefab of the server, so on the server i can't press any button couse they'r covered by the client prefab. any ideo to fix it?
Is there a reason why OnStartClient has to foreach the same prefabs folder that OnStartServer can just put in spawnablePrefabs? Its the same method right?
Amazing video, clear and concise explanations at every step. Really helped break down the process of setting up a lobby, which I've been too daunted by before now to get any further than the first couple of files on my own! Thank you so much :)))))
I have a question, suppose i have different network managers for different scenes and i set DontDestroyOnLoad to false, how does it work with scene change ? does it work just like that or do you have to do something to make it work ?
As soon as my client connects I get this warning: KCP: received unreliable message in state Connected. Disconnecting the connection. Any ideas? I'm using ParrelSync rather than building the game.
@@nasostsionas Unfortunatly, no. I tried changing from kcp transport to telepathy transport on the networkmanager object (as Dapper has in his video). Now I instead get the following message when the client joins the server: ReceiveLoop: finished receive function for connectionId=1 reason: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'.
Yea, there is definatly something wrong with the custom network manager. There are no issues to connect when using the default network managers. I'm trying another tutorial to see if that works better
@@Hairclone Yeah I agree with you because me too I have no problem connect with the default network manager (even through internet) but with the custom network manager I always get that damn error :'(
@@nasostsionas The error is in the OnServerConnect method. For me it somehow always thinks that the menu scene is NOT active and disconnects. Try reconnecting the client once more after the error or comment out that part of code and see if it works out for you.
thank you for the tutorial, so far, I have the host game or start game running, but for some reason, my other app that is on my unity studio, i run it, and try to click join, doesnt go... it just disconnects or times out... i run it to connect local host and made sure my firewall is turned off... I tried the network manager actual mirror... and it runs fine... any ideas? anything i can paste or send you that could help figure this out?
Currently both of the lobby UI's spawn on the host's client. I tried moving everything from OnServerAddPlayer to OnClientConnect, which fixed that problem but then the OnStartClient on the spawned object would not be called. If anyone has a fix lemme know
fisrt , thank you so much for this tuto , then i don't know why when i see Get and Set i really dont know how it works , i'm confused each time i see get and set , even though i have knowledge about programming in c#
It's about getting and setting the variable. If it's a { get; private set; } it means that the variable can be read from other classes but only set privately (in the class with the variable)
For some reason, when I start host, its fine, the secondary client, is able to connect, BUT when I look at host, I don't see RoomPlayer(Clone) prefabs being created for the one hosting and the other joining... i checked... I am pretty close to exactly what is on the tutorial... BUT like couple of things people in the comments pointed out, some minor issues and fixes... anyone else come across this issue?
@@ThePro-ng4yt Cool thanks, your right, I used the Network manager, and it works, the client shows up, not sure why the RoomPlayer(clone) doesn't show up when using the NetworkManagerLobby :(
I am not able to add the room player prefab as the player prefab in the network manager lobby. I get the error that player prefab must have NetworkIdentity. My room player does have the network identity component. And I have applied the changes to the the prefab as well. It still won't let add it to the network manager. Please help me.
Ok if anyone has this problem, the issue is you might have added the standard network identity, and not the one from Mirror. After fixing this, it should work.
Hello, I love your tutorials Dapper, thank you so much! Also is there a way to generate a join code rather than using an IP address and if so will you add it in a tutorial or github (not a request just a question)?
What I reccomend for ur clips to use diffrent workflow or order when u record this tutorials, first show us UI then code. This way u keeping trowing new files and scipts, but when u create it I do not know why do u need that new script, so script doesnt make sense until I see UI and then I need to scroll through scipts again to understand why I wrote some methods. In this alternative I will understand it first time, while I am writting code. But thank u for ur work anyway, keep going :D
Yeah I think he should do the UI first before the scripts, because I gave up right after the UI
I second this because our UI is usually different from your UI and it's better to know in advance what parts of your code we should ignore and it's also really confusing when you mention all these different scripts but we don't even have a visual representation yet of why we are doing it this way, this does cause us to have to jump back and forth a lot.
Thanks for these excellent tutorials, hope you don't mind our feedback.
The fact that u have every program on your taskbar open (even league of legends) triggers me XD
BIG thank you to stefan429, he is right, well the things he mentioned in his comment:
if youre having issues, MAKE SURE:
1. your networkManager has the roomPlayer prefab assigned at the bottom
2. youre using path instead of name for checking the active scene in both OnServerConnect AND OnServerAddPlayer in NetworkManagerLobby, i.e. SceneManager.GetActiveScene().path
so for number 2, in detail, in the youtube tutorial, it shows:
if(SceneManager.GetActiveScene().name != menuScene)
{
conn.Disconnect();
return;
}
BUT you need to change it to:
if(SceneManager.GetActiveScene().path != menuScene)
{
conn.Disconnect();
return;
}
that fixed the problem... ONE LAST thing i am trying to figure out, is my lobby, the Roomplayer prefabs never show up on the Left side that shows the tree and the objects... not sure why :(
Thanks man!
Helpful comment upvoted!
same problem, when a client joins the lobby it sais : server disconnect, connection id1, please let me know if you've solved the problem
@@meddjihed9108 If you have the bug where Roomplayer doesn't get instanciated:
NetworkManagerLobby.menuScene doesn't get converted to the rigth string, so
if (SceneManager.GetActiveScene().name == menuScene)
won't be true.
Fix this by making
[SerializeField] string menuScene;
And type in the scene name in the inspector instead of dragging in the scene.
Used Unity 2020.1.6f1
Credit:- @Julian Röckl
Life saver !
public void SetPlayerName(string name)
{
continueButton.interactable = !string.IsNullOrEmpty(name);
}
this line of code is broken for no reason. But it got fixed with
public void SetPlayerName(string name)
{
continueButton.interactable = nameInputField.text.Length >= 4;
}
I do not know why it got fixed
Thank you
thanks kkk
You can change the line below to make "continueButton.interactable = !string.IsNullOrEmpty(name);" work
private void SetInputField()
{
if(!PlayerPrefs.HasKey(PlayerPrefsNameKey)) { return; }
string defaultName = PlayerPrefs.GetString(PlayerPrefsNameKey);
nameInputField.text = defaultName;
SetPlayerName(defaultName);
}
to
private void SetInputField()
{
if(!PlayerPrefs.HasKey(PlayerPrefsNameKey)) { nameInputField.onValueChanged.AddListener(delegate { SetPlayerName(nameInputField.text); }); ; return; }
string defaultName = PlayerPrefs.GetString(PlayerPrefsNameKey);
nameInputField.text = defaultName;
SetPlayerName(defaultName);
}
I think it would be better if you wrote the code in front of us so that we can see all the code and understand what is happening in the code
If you have the bug where Roomplayer doesn't get instanciated:
NetworkManagerLobby.menuScene doesn't get converted to the rigth string, so
if (SceneManager.GetActiveScene().name == menuScene)
won't be true.
Fix this by making
[SerializeField] string menuScene;
And type in the scene name in the inspector instead of dragging in the scene.
Used Unity 2020.1.6f1
Thank you so much! I wonder if this is a bug or if it's just a weird way Unity handles the string from a scene.
thank you mate :) This fixed my issue.
alternatively, you could use GetActiveScene().path instead of the `name`, because the menuScene variable returns the asset path instead of asset name.
@@fadhil0o0o0 Sonds like a better solution, didn't knew that. Thanks for pointing it out!
thank you so much, this was the issue i had for so long
Its a really good tutorial but you should explain more thoroughly or go slower , i was stuck trying to figure out why my intelisense would not recognize the event action bit and in the end i realized is because i was missing using system. But overall a really great tutorial man.
Thank you. This comment helped me a lot, I had the same issue.
Make sure you check out the project in github too - that's how I fixed all my missed imports that were throwing errors :) my ide is awful at picking up intellisense haha
ClientScene was merged into NetworkClient on the mirror docs
what was the first game you created when you were beginner?
BTW i loved this tutorial :)
Thanks :) Have a look at this: ua-cam.com/video/5aTRbxUWrI4/v-deo.html
I'm following your wonderful series (which you said it is not a series ahahah), anyways, is there the possibility to create multiple lobbies contemporarily to which the users can connect by a name or an ID? I mean private lobbies for groups of people
Would love some help - My unity player launches the lobby fine when I host, when I join the localhost on the build version it joins but all it says is "Lobby Tutorial" it doesn't create another player. I'm not getting any errors. Thoughts?
I have exactly the same problem. Its even saying in the console, that another player joined
@@davidandrestorresbetancour6527 Thanks!
same problem
i'm having trouble navigating the Git Hub page, many files seem to be deleted, is it a mistake on my part?
thank you very much for this tutorial
Guys help me, my "Empty" object is not spawning, and neither is the "NetworkGamePlayerLobby" prefab. It's all set right in NetworkManager.
if anyone knows please help me.
How do I make rooms available from the server, when clients connect to the server will see those rooms?
each server is a room
if I host a game on unity my roomplayer instantiated but if ıtry to join a game in build another room player couldn't instantiate. Can someone help me
I get a little lost, trying to figure out what code we are supposed to create, and what code comes with Mirror. I definitely love it when you show us your screen while you type it out.
Either way it is a great tutorial, and definitely helps us create a network lobby without any experience. Thank you!
Yeah i also Like him while Explaining and Typing but its okey
[Solved]
it seems like everything with the connection and UI works, but i cant see the roomplayer objects. yes i assigned them in the inspector of the network manager
Edit: i wrote the Function for the Host not for the client xD
I think I'm having the same problem, which function are you referring to?
@@Snerlerx it was the OnStartHost function, you have to change it to OnStartClient
@@FireJojoBoy Didnt work :/ thanks anyway
@@Snerlerx have you tried changing the getActiveScene.name to getActiveScene.path ?
How to make sure that players create all lobbies on one server, and not connect via IP?
thanks for the great tut! I'm having a really weird issue, where i am trying to override methods from the NetworkManager but it says that no suitable method can be found. I swear I'm inheriting from the base class correctly
Okay, I solved the problem for anyone who might be interested, the problem was that i had another package installed (called rasa, a chatbot framework) which also had a class called NetworkManager which I was inheriting from. Oops
I have the same issue but I dont have any packages like that and I dont know what to do or how to check for any packages that might have that
It would appear there is no function called OnClientConnect() in the class NetworkBehaviour. Has it been removed in some update since this video, or has it changed name?
change the NetworkBehaviour to NetworkManager
@@X_TYR_X Alright, thank you!
You are to fast to be able to understand what you have to do
ClientScene was merged into NetworkClient on the mirror docs
thx dude, you are the best
thx
ur a G
Whenever I join lobby on my remote build after hosting a lobby it connects, creates player, than instantly disconnects. It goes onEnable, joinLobby, onStartClient, onClientConnect, handleClientConnected, onDisable, onClientDisconnect. Did anyone have a similar issue?
Having the same issue, has anybody found a solution to this problem? The roomplayer gets instantiated on host but as when I go to join on a different computer the OnServerAddPlayer() method is not even called, I then am promptly disconnected.
@@Imdad6629 I have solved the problem with me hope it can help you and also the others if someone has the same problem. so go to the game object "NetworkManager" where you also have the NetworkManagerLobby script on it, with me has there always automatically created the Kcp transport that's wrong delet it. search for "Telepathy Transport" at component and link it in the inspector in the NetworkManagerLobby script.(my english is not so good i hope it helps u out :)
After following this video and the next one in the playlist, I'm having trouble connecting a client to the host. I've ensure the transport IP is localhost, but still no results.
If it helps, the logs show the host accepting the connection and then the client immediately disconnects. On the flip side when running a client in editor and attempting to join the lobby by specifying "localhost", the only message that appears is a timeout message.
Any ideas what could be going on here?
I actually solved the issue on my own after taking a break and coming back to this. The menuScene variable doesn't store the correct value. I simply hard-coded it to the value of "Scene_Lobby" to get it to work. Hope this helps anyone who might be having this problem!
This is a lovely tutorial! It really helped me get started in building a LAN lobby, and saved me hours of time and headache !
However.. I was wondering if it was possible to connect using a room name instead? Something like substituting the IP address with the room name when the lobby is created
I am having trouble doing that and the system can only recognise the network address being changed locally, while the network address of the host is something like 'my room', in the client, it registers as 'localhost' still.. Any help would be much appreciated, I've spent so much time trying to figure this out and am unable to do much about it >
Sure, but you need a backend solution for that. It should store map with ip_address => room_name and when user sends room name to server, it should resolve it with ip address.
@@mikekozlov3484 Thank you for the reply! I've decided to use another way for network discovery but this is very useful to know!
@@littledumpling5614 Hello! I used another method, so if you're looking for how to do something similar to what I wanted to using the localhost method, I'm afraid I can't help you. If you'd like to know the other method however, I'll explain a bit about it!
So rather than have my players input the IP or localhost, I decided to use Network Discovery instead.
Basically, NetworkDiscovery, upon starting a local host, will advertise it as a server, so all clients will be able to see it when they look for a server, and will then be able to join it!
It's also possible to display a list of servers active, I didn't do it for my project because it isn't needed. The built-in script does make that work though, so I recommend experimenting with it.
Here's what I used to get started: mirror-networking.com/docs/Components/NetworkDiscovery.html?q=network%20discovery
All the best!
YO thanks, but i was wondering, does this work only for local clients or can i connect to servers remotly?
@@radue9658 I'm afraid I don't really know the answer to that, so you'll have to experiment and try it out yourself, all the best!
1:00 - Coding
5:51 - Setting Up UI & Prefabs
11:15 - Testing
I'm getting a 'no suitable method found to override' error for both the OnServerAddPlayer method and the OnServerConnect method. Any solution? thanks in advance :)
me too, I'm also having that issue:
[EDIT]
Found out why and how to fix it:
change "public override void OnServerDisconnect(NetworkConnection conn)" to "public override void OnServerConnect(NetworkConnectionToClient conn)"
Thanks for the tutorial! One question though. In the "OnServerAddPlayer" function, why did you instantiate the roomplayerprefab instead of a player prefab. Is there a reason for this?
same problem, do you find any solution???
@@A_Reaper23 The reason is, I guess, this script is only making players join the Lobby Room and not the Game itself. Things like PV, Mana and else that we could need in game won't be usefull in lobby so we can use different prefabs.
(I hope you did find your answer before but just in case you didn't ... ;) )
When I click host the player prefab spawns which is great! Though when I go to click join with the other client I get a timeout. Using localhost and such, I am unsure where I went wrong. Been looking through all day for a solution. Hopefully I will come across something.
Did you find a solution? Been debugging for hours
THANK YOU for your tutorials. Great tuts, great channel, great tutor.
You're welcome :) Glad I could help
I dont know why, but my overrides dont work
Did you solved it?
@@augustoantenucci4725 Use NetworkManager instead MonoBehaviour or something
@@eloreneloreneloreneloreneloren thanks
@@augustoantenucci4725 delete all scripts from the prefab, then go to the prefab in the scene and add the scripts
When I follow your code and try running, I don't see the two objects instantiated in the Hierarchy. Is this supposed to happen?
Have you found out how to solve it? Exactly the same problem xD
@@BSalabert did you dfind out how to solve it?
Guys I found the problem, since I had the same ^^
using [Scene] [SerializeField] private string menuScene;
results the string being "your current path to the assets folder + path to your scene + scene name".
Now in the OnServerConnect method we check if the client tries to join an ongoing game, where we check if(SceneManager.GetActiveScene().name != menuScene).
That results in checking the hole path string against just the scene name.
So the Client gets disconnected immediately and the roomPlayer doesnt gets instantiated.
If you fix the string menuScene, to only contain the actual scene name, it will work properly ! :D
@@Frenuellcrackser33 i now get a error saying the object i want to instantiate is null, i've bene looking for a while but cant find a answer, would you be able to point me in the right direction? also thanks for the previous fix :) the error is with the instantiation of roomplayerprefab in Networkmanager
@@broForseNetwork make sure that rhe RoomPlayer Prefab is referenced in the NetworkManager(Lobby) script in your scene. For the Player Prefab aswell as the Room Player Prefab.
Hey Dapper Dino ^^
I really appreciate these tutorials!
I learn a lot from you and it's great.
I've looked at the Mirror documentation because I really want to be able
to name my lobby, your tutorial showed how to connect directly via. IP address, but if I want a server list, surely I would also want names for servers.
Could you perhaps show how to do that?
I've looked around the internet for days and can't find anything.
Thank you in advance :)
To clarify, what i mean is how to name a server when creating it, I can only find StartHost() and StartServer() where none of them takes a parameter.
Yeah me too man I wish he do it
Me too
A server browser needs a dedicated matchmaking system which you'd permanently host on a separate server. Steamworks is your best bet though you can use others.
Me: Copies code into Unity
Unity: 8 ERRORS
Me: 8?!
I have that issue too, usually something small Ive missed, or just version differences,
It doesn't connect when pressing join
I also had the problem where the RoomPlayers weren't showing in the Hierarchy after players were joined. To fix this I had to update the OnClientConnect / OnClientDisconnect functions in NetworkManagerLobby.cs:
public override void OnClientConnect()
{
base.OnClientConnect();
OnClientConnected?.Invoke();
}
public override void OnClientDisconnect()
{
base.OnClientDisconnect();
OnClientDisconnected?.Invoke();
}
Hey Its possible for you to make a tutorial about syncing Mirror + Fizzy + Steamwork ? I use Steamwork complete V2 with Mirror and FizzySteam , I follow your tutorial , But I don't understand how to link correctly my networkManager and my LobbyManager from Steamwork. :/
this is really hard to follow, i would really prefer showing us the process of you coding each part even if it takes longer
I did this, but my Roomplayer prefab doesn't create, but he is in the network manager as player prefab and player room prefab, what could i have done wrong? Edit: i found it for some reason my MenuScene string does not work so i needed to hardcode it like this == "Lobby"
Hey there Victor, I had the same problem, i fixed it by replacing all accurances of SceneManager.GetActiveScene().name with SceneManager.GetActiveScene().path and that fixed it for me. Also that way you avoid using hardcoded strings inside code, like your "Lobby" string for example.
@@jadranzagorac6540 thank you for this!
Legend! Thank you!
@@jadranzagorac6540 Thank fucking god for this.
How can I make it Multiplayer out side of just the same network connection?
A big hug from Brazil, Thanks so much
when i enter the ip address it doesn't take me into the lobby. and it comes with the error "could not resolve the host" and then after that it would say whatever name i have put in
what for ip u typed in are u on the same network on both devices?
Spawning in the registered prefabs doesnt work for me-
every time it throws me this message-
Replacing existing prefab with assetId '[assetId of Prefab]'. Old prefab 'RoomPlayer', New prefab 'RoomPlayer'
UnityEngine.Logger:Log(LogType, Object)
Any help here? i'm really stuck on this.
check out the solutions from @scribl1 and @Coldsandwich. it resolved this issue for me.
Can you just join a random game instead of entering an address?
yes
@@0x19 but how do we do that?
Idk actually still learning mirror but i did the random join thing before in a Minecraft plugin
Search for the Mirror Component NetworkDiscovery. With that you can Broadcast your server on lan (AdvertiseServer) and also search for available Servers
PlayerPrefs is volatile right. It's only accessible till the app cache is uncleared. When the player clears the cache then the data saved is gone right?
NetworkManagerLobby.OnClientConnect(NetworkConnection)': no suitable method found to override
NetworkManagerLobby.OnClientDisconnect(NetworkConnection)': no suitable method found to override
Make sure you have using Mirror; at the top
I am having this same issue. OnClientConnect and OnClientDisconnect aren't part of NetworkBehaviour. I wonder if this is a recent change?
I FIXED IT! Replace NetworkBehaviour with NetworkManager
@@Marcusaralius76 wow. It worked. Thank you very much
@@Marcusaralius76 not working :(
If I chance my username when I want to connect there is no error but I can't click that confurn button so I need to play as "enter name..."
Did you solved the problem? I have a same issue :(
Hi, I'm also having the same button issue. I noticed that I could press it once before i put any text into the Inputfield but then once I did, every time i ran the game after that I was unable to press the confirm button. :(
EDIT: G Chozick has a method that fixed it for me. When you on the "InputField_Name" you change the OnValueChanged from a static to dynamic.
@@kyleweeks761 late reply but:
put name = nameInputField.text; before the continuebutton line in SetPlayerName
the name string is actually not linked in any way to the input field in the original code which is why it will always return true to the isnullorempty and the button will always be noninteractable
@@thelittlechemist941 THANK YOU THANK YOU THANK YOU!!!!
Is this local multiplayer only???
No, It's using a networking solution called Mirror. He has another video where he shows you how to set it up, and the thumbnail is a multiplayer remake of pong. Hope this helped!
any good advice if I want to use a join code to join a lobby using mirror?
Client Recv: failed to connect to ip=localhost port=7777 reason=System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.TcpClient.Connect (System.String hostname, System.Int32 port) [0x0019d] in :0
at Telepathy.Client.ReceiveThreadFunction (System.String ip, System.Int32 port) [0x00002] in C:\Users\Anca\Documents\AR\ar1\Assets\Mirror\Runtime\Transport\Telepathy\Client.cs:54
UnityEngine.Debug:LogError(Object)
Telepathy.Client:ReceiveThreadFunction(String, Int32) (at Assets/Mirror/Runtime/Transport/Telepathy/Client.cs:74)
Telepathy.c__DisplayClass11_0:b__0() (at Assets/Mirror/Runtime/Transport/Telepathy/Client.cs:157)
System.Threading.ThreadHelper:ThreadStart()
Anyone knows what is this? This appears right after I click on 'Join Lobby'
Actually I get this because I tried to join with my phone, the lobby I've created on my laptop... so is this not possible or what?
Thank you very much for this effort👍
No worries!
اخي مهدي.. هل اللوبي هنا يعمل كنظام البلوتوث ؟ يعني اللاعبين القريبين من بعض فقط ؟
for some reason the continue button on the external build doesn't enable when i type my name. but when i test it in unity itself it works fine. any suggestions what causes this issue?
Use the dynamic function
@@fazesponge1422 how?
Your tutorial is awesome ..! I've got a question. what if i want to connect to my friend's game but i use different network connection. So what should i do?
Great video
Thanks :)
The tutorial is nice, but im not finding the scripts on github.
its in the mirror tutorial section of Dapper Dino's github. He didnt have seperate gits for each video, so the git you see is the completed version after following all the tutorials in this playlist
@@FullStackIndie yeah but i cant seem to find the script files either
Hey one question does this work also by remote or only for local clients? Btw those tutorials are really cool.
Also i'm having a problem whith the input field that doesn't work: when i click on it nothing happens
You have to create an event system. Top left plus icon > UI > event System
Thanks, I solved it but fo you know if this works also for remote clients that connect using the IP addresses?
You can either look up how to port-forward for your router or look into using stream as a relay: ua-cam.com/video/QlbBC07dqnE/v-deo.html&ab_channel=DapperDino
@@DapperDinoCodingTutorials yo thanks Dapper Dino, I appreciate a lot
Hey Dapper sorry if i take your time with those questions but i would like to know if you already did a video about interracting with objects or spawn objects or other similar things in a multiplayer game. Sorry again
Can I use proton and mirror?
What coding app did you use?🎁
Visual studio
we didnt understand
Using the code from the github created tons of namespace errors among others too, any fix?
same problem
He uses the namespaces to organize things. Don't copy the entire files over if you don't want to type the methods up yourself. Take only the class and the includes.
what are these errors i just copied everything lol,
1.
Assets\Lobby Scene\Scripts\NetworkManagerLobby.cs(19,34): error CS0246: The type or namespace name 'NetworkGamePlayerLobby' could not be found (are you missing a using directive or an assembly reference?)
2.
Assets\Lobby Scene\Scripts\NetworkManagerLobby.cs(27,21): error CS0246: The type or namespace name 'NetworkGamePlayerLobby' could not be found (are you missing a using directive or an assembly reference?)
edit: I cant Also find Network Identity and all scripts i have them but i cant drag them to RoomPlayer???
how to list the host
i'm getting an error in the networkmanagerlobby script saying that the name 'ClientLobby' does not exist in the current context. How could i fix this?
It is spelled "eelyA gavrEElov" Dapper Dino san)) Upper cases are the stress letters
Great video, been needing to do this for my own game
Nice! Hope it helps :)
Hi, iam facing collision detecting issue with raycast in addtitive scene in multiplayer game. player not able to detect other objects in additive scene but on mainscene it works.Can anyone help me with this fix?
I really hope I didn't miss anything, but for some reason it doesn't allow me to click in the Input Field in the first place. Does anyone know what could be the problem??
Nice video, cant wait for the others
Me either :D
Im pretty sure its not supposed to happen, but when I test it out, it crashes the game. Im not sure where I went wrong, becuase it doesn't really give a reason why
Tags for ctrl+f users: "Cant" "Connect" "Join" "Instantiate" "Room" "Player" "Prefab"
SOLUTION FOR CANT CONNECT WITH JOIN BUTTON
I dont know why but as its like that in NetworkManager, StartClient() function should be above of "networkAdress = ipAdress" line.
This fixed my problem that "Join button wasnt working."
So shortly replace JoinLobby with this:
public void JoinLobby()
{
string ipAdress = ipAdressInputFieldText.text;
networkManager.StartClient();
networkManager.networkAddress = ipAdress;
}
hi, i have a strange issue, when client join i can see in server the new prefab, but it's created over the prefab of the server, so on the server i can't press any button couse they'r covered by the client prefab. any ideo to fix it?
Not even a tutorial, you are just telling us what everything does, and showing us what we could do.
Yea I know I don't even know where to start XD
Yea I don't know where to start XD
this is the point of a tutorial show and explain
Room player prefab doesn't spaw when hosting and joining, any idea on how to fix this ?
Why do you say landing page to a couple of buttons? XD
10:08 just Ford me. Nothing special
the continueButton dosent get interactable after type in username what should i do?
Thanks! Also I like the fact that you have LoL opened in background.
Is there a reason why OnStartClient has to foreach the same prefabs folder that OnStartServer can just put in spawnablePrefabs? Its the same method right?
please help it always says cannot resolve host
Amazing video, clear and concise explanations at every step. Really helped break down the process of setting up a lobby, which I've been too daunted by before now to get any further than the first couple of files on my own! Thank you so much :)))))
This doesnt work for me :/
I have a question, suppose i have different network managers for different scenes and i set DontDestroyOnLoad to false, how does it work with scene change ? does it work just like that or do you have to do something to make it work ?
FINALLY ONE THAT ISNT FROM 69 YEARS AGO HOLY SHIT
How do you list existing lobbies to choose from rather than just inputting the lobby name? Where is that info hosted to?
This video has to be place before
As soon as my client connects I get this warning: KCP: received unreliable message in state Connected. Disconnecting the connection. Any ideas? I'm using ParrelSync rather than building the game.
did you found anything on this?
@@nasostsionas Unfortunatly, no. I tried changing from kcp transport to telepathy transport on the networkmanager object (as Dapper has in his video). Now I instead get the following message when the client joins the server:
ReceiveLoop: finished receive function for connectionId=1 reason: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
Yea, there is definatly something wrong with the custom network manager. There are no issues to connect when using the default network managers. I'm trying another tutorial to see if that works better
@@Hairclone Yeah I agree with you because me too I have no problem connect with the default network manager (even through internet) but with the custom network manager I always get that damn error :'(
@@nasostsionas The error is in the OnServerConnect method. For me it somehow always thinks that the menu scene is NOT active and disconnects. Try reconnecting the client once more after the error or comment out that part of code and see if it works out for you.
thank you for the tutorial, so far, I have the host game or start game running, but for some reason, my other app that is on my unity studio, i run it, and try to click join, doesnt go... it just disconnects or times out... i run it to connect local host and made sure my firewall is turned off... I tried the network manager actual mirror... and it runs fine... any ideas? anything i can paste or send you that could help figure this out?
How would I find a random match? Im making a game where you verse other people, but I dont want to use IP address
How to auto start, so that player can join if there are any matches having some vacancy else can host a game. Please reply. Thank you in advance 👍
Currently both of the lobby UI's spawn on the host's client. I tried moving everything from OnServerAddPlayer to OnClientConnect, which fixed that problem but then the OnStartClient on the spawned object would not be called. If anyone has a fix lemme know
fisrt , thank you so much for this tuto , then i don't know why when i see Get and Set i really dont know how it works , i'm confused each time i see get and set , even though i have knowledge about programming in c#
It's about getting and setting the variable. If it's a { get; private set; } it means that the variable can be read from other classes but only set privately (in the class with the variable)
@@DapperDinoCodingTutorials ohh i undestand better now , thank you so much
For some reason, when I start host, its fine, the secondary client, is able to connect, BUT when I look at host, I don't see RoomPlayer(Clone) prefabs being created for the one hosting and the other joining... i checked... I am pretty close to exactly what is on the tutorial... BUT like couple of things people in the comments pointed out, some minor issues and fixes... anyone else come across this issue?
@@ThePro-ng4yt Cool thanks, your right, I used the Network manager, and it works, the client shows up, not sure why the RoomPlayer(clone) doesn't show up when using the NetworkManagerLobby :(
How to create lobby using javaScript ? Also How to display a random code where other player can use to join the lobby ?
this is for c# bro
I am not able to add the room player prefab as the player prefab in the network manager lobby. I get the error that player prefab must have NetworkIdentity. My room player does have the network identity component. And I have applied the changes to the the prefab as well. It still won't let add it to the network manager. Please help me.
Ok if anyone has this problem, the issue is you might have added the standard network identity, and not the one from Mirror. After fixing this, it should work.
i need to make the network mannager if im using mirror?
when i click on host lobby i get this error message "NullReferenceException: Object reference not set to an instance of an object"
There is one object that is Not assinged top the script i think(sorry my Englisch is Not so good)
Thanks a lot for doing this
Thanks bro
Can You make os to Download You game ??? Plz.
you can
@@coolerbast1 How
@@hansiindgame1375 create a github account, sign in and download the files
@@coolerbast1 okay
Hello, I love your tutorials Dapper, thank you so much! Also is there a way to generate a join code rather than using an IP address and if so will you add it in a tutorial or github (not a request just a question)?