{"id":32003,"date":"2024-11-01T09:04:51","date_gmt":"2024-11-01T09:04:51","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32003"},"modified":"2024-11-01T11:33:45","modified_gmt":"2024-11-01T11:33:45","slug":"unity-basics-course-network-lobby-screen-create-room","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32003\/","title":{"rendered":"Unity Basics Course: Network Lobby Screen &#8211; Create Room"},"content":{"rendered":"<p>Hello! Today, we will learn how to create a simple network lobby screen using Unity. In this tutorial, we will implement the room creation feature and explain how users can enter or create rooms. Let&#8217;s understand the basic concepts of network game development and practice using Unity&#8217;s networking features.<\/p>\n<h2>1. Unity and Networking<\/h2>\n<p>Unity is a powerful game engine that provides various features for network game development. The networking API provided by Unity, UNET (Unity Networking), helps to easily implement various networking functionalities. However, UNET is no longer actively supported, and it&#8217;s advisable to use Unity&#8217;s new networking solutions, Mirror or Photon. This tutorial will focus on creating a network room using Mirror.<\/p>\n<h2>2. Project Setup<\/h2>\n<p>Create a new project in Unity. Set the basic template of the project to 3D and name the project &#8216;NetworkLobby&#8217;. Then, let&#8217;s proceed with the following steps.<\/p>\n<h3>2.1 Installing the Mirror Package<\/h3>\n<p>1. In the top menu of the Unity Editor, select <strong>Window<\/strong> &gt; <strong>Package Manager<\/strong>.<\/p>\n<p>2. Click the <strong>+<\/strong> button and select <strong>Install from git URL&#8230;<\/strong>.<\/p>\n<p>3. Enter <strong>https:\/\/github.com\/vis2k\/Mirror.git<\/strong> in the URL input field.<\/p>\n<p>4. Once the installation is complete, the <strong>Mirror<\/strong> package will appear in the package list.<\/p>\n<h3>2.2 Setting Up the Basic Scene<\/h3>\n<p>1. Select <strong>File<\/strong> &gt; <strong>New Scene<\/strong> to create a new scene.<\/p>\n<p>2. Create a Canvas to configure the basic UI. Right-click in the Hierarchy window and select <strong>UI<\/strong> &gt; <strong>Canvas<\/strong> to add a new Canvas.<\/p>\n<p>3. Add UI elements under the Canvas. Add buttons, input fields, and text to create the lobby screen.<\/p>\n<h2>3. Setting Up the Network Manager<\/h2>\n<p>The core of a network game is the Network Manager. The Network Manager manages the connection between clients and the server. In this process, we will set up the Network Manager and write basic code for room management.<\/p>\n<h3>3.1 Adding the NetworkManager<\/h3>\n<p>1. In the <strong>Hierarchy<\/strong> window, right-click and select <strong>Network<\/strong> &gt; <strong>NetworkManager<\/strong> to add a new network manager.<\/p>\n<p>2. Select the <strong>NetworkManager<\/strong> object and adjust the settings in the inspector. Remove the Fake Player Prefab in <strong>Spawn Info<\/strong> and add <strong>TelepathyTransport<\/strong> in the <strong>Transport<\/strong> section.<\/p>\n<h3>3.2 Writing a Custom Script<\/h3>\n<p>Write a controlling script to implement room creation and entry features. Create a new C# script and name it <strong>NetworkLobbyManager.cs<\/strong>.<\/p>\n<pre><code>using Mirror;\nusing UnityEngine;\nusing UnityEngine.UI;\n\npublic class NetworkLobbyManager : NetworkManager\n{\n    public InputField roomNameInput;\n    public Button createRoomButton;\n    public Button joinRoomButton;\n\n    public override void OnStartServer()\n    {\n        Debug.Log(\"Server started!\");\n    }\n\n    public void CreateRoom()\n    {\n        if (string.IsNullOrEmpty(roomNameInput.text))\n        {\n            Debug.Log(\"Room name cannot be empty!\");\n            return;\n        }\n        \/\/ Handle room creation\n        Debug.Log(\"Room created: \" + roomNameInput.text);\n        NetworkServer.Listen(12345);\n    }\n\n    public void JoinRoom()\n    {\n        \/\/ Handle room entry\n        Debug.Log(\"Joined room: \" + roomNameInput.text);\n        networkAddress = roomNameInput.text;\n        StartClient();\n    }\n\n    public void OnEnable()\n    {\n        createRoomButton.onClick.AddListener(CreateRoom);\n        joinRoomButton.onClick.AddListener(JoinRoom);\n    }\n\n    public void OnDisable()\n    {\n        createRoomButton.onClick.RemoveListener(CreateRoom);\n        joinRoomButton.onClick.RemoveListener(JoinRoom);\n    }\n}<\/code><\/pre>\n<p>This script contains the basic logic for creating and entering rooms. It allows users to create or enter a room based on the room name they input.<\/p>\n<h2>4. UI Configuration<\/h2>\n<p>To improve user experience, adjust the UI layout and styles to configure the UI elements more specifically.<\/p>\n<h3>4.1 Configuring Inside the Canvas<\/h3>\n<p>1. Add a <strong>Panel<\/strong> under the Canvas. This panel will be the main background of the lobby.<\/p>\n<p>2. Add a title text above the panel (e.g., &#8220;Game Lobby&#8221;).<\/p>\n<p>3. Add room name input field along with buttons for creating and joining rooms.<\/p>\n<h3>4.2 Connecting Button Events<\/h3>\n<p>Connect the create and join room buttons to the methods of the network manager. In the Unity editor, assign the relevant methods to the buttons&#8217; <strong>onClick()<\/strong> events.<\/p>\n<h2>5. Testing and Debugging<\/h2>\n<p>Once all functionalities are implemented, it is necessary to conduct final testing. Run several instances of the Unity editor to check if clients can create and enter rooms.<\/p>\n<h3>5.1 Running the Server<\/h3>\n<p>Click the <strong>Start Game<\/strong> button in the Unity editor to run the server. Ensure that the server is operating correctly.<\/p>\n<h3>5.2 Running the Client<\/h3>\n<p>With the server running, execute the client in another instance and enter the room. This process will allow you to see multiple clients interacting.<\/p>\n<h2>6. Conclusion<\/h2>\n<p>In this tutorial, we learned how to create a simple network lobby screen using Unity. We implemented basic features for room creation and entry using Mirror, and demonstrated how to enhance user experience through simple UI configuration and event handling.<\/p>\n<p>Network game development becomes more fascinating the more you learn. Based on the basic knowledge gained in this tutorial, I encourage you to explore more complex network systems.<\/p>\n<p>Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello! Today, we will learn how to create a simple network lobby screen using Unity. In this tutorial, we will implement the room creation feature and explain how users can enter or create rooms. Let&#8217;s understand the basic concepts of network game development and practice using Unity&#8217;s networking features. 1. Unity and Networking Unity is &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32003\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Unity Basics Course: Network Lobby Screen &#8211; Create Room&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[135],"tags":[],"class_list":["post-32003","post","type-post","status-publish","format-standard","hentry","category-unity-basic"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unity Basics Course: Network Lobby Screen - Create Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/32003\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity Basics Course: Network Lobby Screen - Create Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Hello! Today, we will learn how to create a simple network lobby screen using Unity. In this tutorial, we will implement the room creation feature and explain how users can enter or create rooms. Let&#8217;s understand the basic concepts of network game development and practice using Unity&#8217;s networking features. 1. Unity and Networking Unity is &hellip; \ub354 \ubcf4\uae30 &quot;Unity Basics Course: Network Lobby Screen &#8211; Create Room&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32003\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:04:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:33:45+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"4\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32003\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32003\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Unity Basics Course: Network Lobby Screen &#8211; Create Room\",\"datePublished\":\"2024-11-01T09:04:51+00:00\",\"dateModified\":\"2024-11-01T11:33:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32003\/\"},\"wordCount\":648,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Unity Basic\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32003\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32003\/\",\"name\":\"Unity Basics Course: Network Lobby Screen - Create Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:04:51+00:00\",\"dateModified\":\"2024-11-01T11:33:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32003\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32003\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32003\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity Basics Course: Network Lobby Screen &#8211; Create Room\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unity Basics Course: Network Lobby Screen - Create Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/32003\/","og_locale":"ko_KR","og_type":"article","og_title":"Unity Basics Course: Network Lobby Screen - Create Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Hello! Today, we will learn how to create a simple network lobby screen using Unity. In this tutorial, we will implement the room creation feature and explain how users can enter or create rooms. Let&#8217;s understand the basic concepts of network game development and practice using Unity&#8217;s networking features. 1. Unity and Networking Unity is &hellip; \ub354 \ubcf4\uae30 \"Unity Basics Course: Network Lobby Screen &#8211; Create Room\"","og_url":"https:\/\/atmokpo.com\/w\/32003\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:04:51+00:00","article_modified_time":"2024-11-01T11:33:45+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"4\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32003\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32003\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Unity Basics Course: Network Lobby Screen &#8211; Create Room","datePublished":"2024-11-01T09:04:51+00:00","dateModified":"2024-11-01T11:33:45+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32003\/"},"wordCount":648,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Unity Basic"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32003\/","url":"https:\/\/atmokpo.com\/w\/32003\/","name":"Unity Basics Course: Network Lobby Screen - Create Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:04:51+00:00","dateModified":"2024-11-01T11:33:45+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32003\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32003\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32003\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Unity Basics Course: Network Lobby Screen &#8211; Create Room"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=32003"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32003\/revisions"}],"predecessor-version":[{"id":32004,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32003\/revisions\/32004"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}