Main

Build game Online : Everything in Unity Lobby + Client Reconnect + Host Transfer / Visual Scripting

๐Ÿ’ฌ Turn on [CC] to translate to any Languages [JP/FR/GR/EN/VI/CN/KR/ES... all supported] ๐ŸŽฌ All tutorial videos in this Multiplayer series (Netcode, connect P2P, auto join, auto matching, Reconnect after disconected, Steamwork ... ) : https://youtube.com/playlist?list=PLLYnL37vQ02SYU-N_VpHrhG87qjlNhlPl&si=no4cIUPr8uqinAuM โœ… Download script Lobby Manager in video : https://www.mediafire.com/file/y3b90vyd3lf8akb/Lobby.zip/file โญ This Video : How to build a complete P2P with Lobby in Unity Visual Scripting . Prepare Buttons . Step 1 Sign In Lobby . Step 2 Create Lobby . Step 3 Search Matching Games . Step 4 Join in Lobby . Auto Join system . Client reconnect . Host reconnect . Transfer Host === ๐Ÿ€ New in Unity ? Dont know how to code ... Dont worry Learning Path for you : ๐Ÿพ Level 1 : Learn Unity basic in 2D game - For Beginner (all script and resource are FREE ) : https://youtube.com/playlist?list=PLcNb7VR72tXP1Mqcd-vXnn_F6MJE-bbCP ๐Ÿพ Level 2 : Learn Unity basic in 3D game - All videos (all script and resource are FREE ) : https://youtube.com/playlist?list=PLcNb7VR72tXM_3eXrVMxutYa4E-YIJnOa&si=V4VL3VWB4ASR-bsW ๐Ÿพ Level 3 : Learn Unity basic 3rd Person game or 1st Person game (all script and resource are FREE ) : https://youtube.com/playlist?list=PLcNb7VR72tXOeGUBznVOPlJ60zQCMesIN ๐Ÿพ Level 4 : Learn to use C# in Visual Scripting : https://youtube.com/playlist?list=PLcNb7VR72tXOSmzBsUsWCNizzWKmdyxR7&si=lioHEIv1GTsrI-gC ( videos explain all basic C# code soon... ) ๐Ÿพ Level 5 : Make Multiplayer Online game with Netcode in Visual Scripting : https://youtube.com/playlist?list=PLLYnL37vQ02SYU-N_VpHrhG87qjlNhlPl&si=no4cIUPr8uqinAuM ===== ๐Ÿ”ฅ Download Visual Scripting Plus from Unity Asset Store to support me: https://assetstore.unity.com/packages/slug/219926 ===== ๐Ÿ‚ Any questions about Unity or Visual Scripting : https://discord.gg/MsmQ64rX9y ( me @Leo69 ) Follow me at : - Instagram: https://www.instagram.com/leonnguyen0609/ - TikTok: https://www.tiktok.com/@leonng_333 - Twitter : @unitynocode - Fb : unitynocode #madewithunity #visualscripting #gamedev #gamedevelopment #nocode #unitynocode ===== Chapters 0:00 - Intro 0:57 - Prepare 2:25 - Prepare Buttons 3:50 - Step 1 Sign In Lobby 4:59 - Step 2 Create Lobby 7:02 - Step 3 Search Matching Games 8:50 - Step 4 Join in Lobby 11:41 - Auto Join system 13:26 - Lock Lobby 14:45 - Lobby Updated Info 17:01 - Client reconnect 19:04 - Button Leave Lobby 20:10 - Host disconnected ? 21:02 - Can Host Reconnect ? True 23:12 - Transfer Host result

Unity No Code | Leo N

3 weeks ago

After all people are joined in your Lobby already ... You need to Lock lobby to stop other people can not join any more We gonna use this event to Lock it Copy it. Open our script Let's put it bottom of the script After clicking "Button Lock Lobby ... make sure check this to "Lock On" the lobby After Lobby is locked, output "Done" will be triggered Show a message "Lobby is LOCKED ! Build to test it. Create new Lobby After that, click Button Lock Lobby to lock it Now nobody can join this room any
more ... On another device, click "Auto Join" It will create a new Lobby, because it can not join our Locked Lobby Tittle : Lobby Updated Info Create a Button to get the information of current Lobby I will call it "Button Get Lobby" Click event for "Button Get Lobby" Whenever a Player joined in or has left, the Lobby will be updated You must use this event to get the newest information of that Lobby This event will have all information that you need paste it into We need to add the current Lobb
y ID to get its information Now when the Button is pressed, you can get any information you need Let's check how many Members have joined in, and their Player IDs and how many Available Slots have left After creating new Lobby... press Button to get Lobby Information This is my Player ID... and we set up with Max Players is 4 So available slots now is 3 Open another device, click Auto Join Player 2 has joined in Let's check again our Lobby Information ... We have 2 Player IDs now Tittle : Client
Reconnect While the game is playing ... Player 2 or Player 3 is suddenly disconnected ... ... due to no internet or some reasons So we need to reconnect them back to the game We just need to call [Lobby : Reconnect] ... it will auto reconnect him We have events to do it here This one to check if Player is disconnected from last game and this one to reconnect him back to the game As the instruction : we should check it before doing Search Lobbies ... If we clicked on button "Auto Join" Now it wi
ll check if Player is disconnected from last game first ... If "No reconnect issue was found" ... just do Search Lobbies and Join in normally If Reconnection is TRUE ... we need to reconnect Player back to his game This event will reconnect Player back automatically ... If Success this will trigger and if Failed ... just keep going back to Search Lobbies and Join in ... Build and test it First : create a Lobby then get another Player to join in Before start the game or be able to do Reconnect ..
. you must "LOCK Lobby !" While the Lobby is Locked ... it means the game is playing if Player 2 is disconnected You can check the Lobby to see , he was disconnected from the Lobby But Player 2 was back to the game ... If he clicked on Auto Join button ... It will automatically reconnect him back ... Because the game is still being played and Host is still there You can easily reconnect Client with 1 click only Tittle : Button Leave Lobby To leave complete a Lobby and disconnect with Host ... We
will use event "Lobby : Leave" Open our script paste it here Create Button click for "Button Leave Lobby" When Button is clicked, Player will quit the current Lobby completely and no ways to reconnect back after you clicked on this Button Because Player is not disconnected , he leaves it Build to test it First : create a Lobby and another Player to join in check the Lobby to make sure we have 2 Players currently If Player clicked on "Button Leave Lobby" to quit He will be removed from the Lobby
Tittle : Host Disconnect ? Reconnect Client is very easy... How about if Host is disconnected ? Watch again on event "Create Lobby" We have option : [Can Host Reconnect] If it has value "False", when Host is disconnected All Clients will be kicked out of the room also... and Game will be ended Let's test it Create a Lobby and become the Host a Client will be joined in Lock the Lobby to start the game ... But when the game is started ... Host has left or disconnected ... As you see here, all Cli
ents will be kicked out of the game too Tittle : Can Host Reconnect = True Now at [Lobby : Create] , Select "Can Host Reconnect" be True when Host is disconnected It will automatically select Client 2 will be the New Host All other Clients will be reconnect to this New Host auto also Open "Use - Unity Lobby" When Host left or disconnected , we'll know when the New Host is transfered Host left, this event will be triggered If you selected "Can Host Reconnect = True" output "Picking New Host" will
be triggered to tell you know it is transfering new Host and make sure your current Lobby is Locked ! Copy it Open our script Make sure you turned on "Can Host Reconnect" Now if Host is quit or disconnected It will pick the next Client to be a New Host Show message to tell that we are transfering new Host After Client has become a new Host succesfully , this will be triggered all other Clients will reconnect to this new Host as Client also In some reasons, if it failed to transfering new Host o
r failed to reconnect ... output "On Quit" will be triggered So the game should be ended now and back to Main Menu You can show some message ... Your Enemy is surrendered ... and You Win ! Most of Multiplayer Games , they did this All done ! These are everything you will do in a Multiplayer game for a Lobby You always can find an example script inside folder "Macro-UnityLobby" You can copy exactly all the script if you want It will work immediately Tittle : Transfer New Host . Result Build the g
ame to see our final result First : create a new Lobby Next : get a Client to join in Show message to know how many Members in lobby currently It has 2 Players right now Now I will get 1 more Player from another PC to join in also You can export game to your phone to test it as a 3rd Player ... The 3rd Player has joined in Check how many Members in Lobby currently ... We have 3 Players right now On Host device, press "Lock Lobby" to be able do "Host Reconnect" and if Host is quit or disconnected
... Another Client will take over as a New Host All other Clients will reconnect to this New Host Transfer successfully If Old Host was back to game He can reconnect to the game as a Client You understand how everything works now ! In next video : we will do the same Lobby in Steam with 100% free Bandwidth See you in next Tutorial !

Comments