{"id":31817,"date":"2024-11-01T09:03:12","date_gmt":"2024-11-01T09:03:12","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=31817"},"modified":"2024-11-01T11:34:34","modified_gmt":"2024-11-01T11:34:34","slug":"unity-basics-course-creating-an-ending-screen-and-exiting-the-room","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/31817\/","title":{"rendered":"Unity Basics Course: Creating an Ending Screen and Exiting the Room"},"content":{"rendered":"<p><body><\/p>\n<p>Hello! In this tutorial, we will explore how to create an ending screen after making a game in Unity and implement the exit functionality. This tutorial is aimed at those with a basic understanding of Unity and will proceed step by step. Each step will include necessary code examples and explanations.<\/p>\n<h2>1. Course Overview<\/h2>\n<p>This course consists of two main parts:<\/p>\n<ul>\n<li>Creating an ending screen<\/li>\n<li>Implementing the exit functionality<\/li>\n<\/ul>\n<p>Each part will show how to utilize Unity&#8217;s user interface (UI) to enhance the game&#8217;s experience. Through this tutorial, you will learn to add an ending screen to your game and provide a way for users to easily and conveniently exit the game.<\/p>\n<h2>2. The Need for an Ending Screen<\/h2>\n<p>Providing an appropriate ending screen to players after the game ends is an important part of the gaming experience. Through the ending screen, players can review their achievements in the game and choose an option to restart. A good ending screen helps leave a positive impression on players even after they have finished the game.<\/p>\n<h2>3. Creating the Ending Screen<\/h2>\n<h3>3.1 Setting Up the Project<\/h3>\n<p>First, open Unity and create a new 2D project. Let&#8217;s name the project &#8216;EndingScreenExample&#8217;.<\/p>\n<h3>3.2 Setting Up the UI<\/h3>\n<p>To create the ending screen, we need to set up the UI. Follow these steps:<\/p>\n<ol>\n<li>Select <strong>GameObject &gt; UI &gt; Canvas<\/strong> in the Unity editor to add a canvas.<\/li>\n<li>Add <strong>UI &gt; Panel<\/strong> inside the canvas to create a background panel.<\/li>\n<li>Adjust the size of the panel to cover the entire screen.<\/li>\n<li>Add <strong>UI &gt; Text<\/strong> inside the panel to enter the ending message. For example: &#8220;You have completed the game!&#8221;<\/li>\n<li>Add <strong>UI &gt; Button<\/strong> to create a &#8216;Return to Main Menu&#8217; button.<\/li>\n<li>Change the button text to &#8216;Restart&#8217; or &#8216;Main Menu&#8217; in the properties.<\/li>\n<li>Additionally, add background music or sound effects to make the ending screen more interesting.<\/li>\n<\/ol>\n<h3>3.3 Writing the Script<\/h3>\n<p>Now, let&#8217;s write a C# script to implement the functionality of the ending screen. Create a script like the following:<\/p>\n<pre><code class=\"language-csharp\">using UnityEngine;\n    using UnityEngine.SceneManagement;\n    using UnityEngine.UI;\n\n    public class EndingScreen : MonoBehaviour\n    {\n        public GameObject endingPanel;\n\n        public void ShowEndingScreen()\n        {\n            endingPanel.SetActive(true);\n        }\n\n        public void RestartGame()\n        {\n            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);\n        }\n\n        public void QuitGame()\n        {\n            Application.Quit();\n        }\n    }\n    <\/code><\/pre>\n<p>In the above script, the <code>ShowEndingScreen<\/code> method shows the ending screen, and the <code>RestartGame<\/code> and <code>QuitGame<\/code> methods handle restarting or quitting the game when each button is clicked.<\/p>\n<h3>3.4 Connecting Functions to Buttons<\/h3>\n<p>Connect the script to the buttons so that the functions are triggered when they are clicked. After selecting the button, add the On Click() event in the inspector and connect it to the <code>RestartGame<\/code> and <code>QuitGame<\/code> methods of the <code>EndingScreen<\/code> script.<\/p>\n<h2>4. Implementing the Exit Functionality<\/h2>\n<p>Now let&#8217;s add a feature that allows users to easily exit the room when they want to quit the game. This function primarily operates through button clicks and can be implemented through the steps below.<\/p>\n<h3>4.1 Adding a UI Button<\/h3>\n<p>Add a <strong>UI &gt; Button<\/strong> to the main menu or ending screen of the game. Set the button text to &#8216;Exit Room&#8217;.<\/p>\n<h3>4.2 Writing the Exit Script<\/h3>\n<p>Write a new script to implement the exit functionality. Refer to the example below:<\/p>\n<pre><code class=\"language-csharp\">using UnityEngine;\n\n    public class ExitGame : MonoBehaviour\n    {\n        public void ExitRoom()\n        {\n            Application.Quit();\n            #if UNITY_EDITOR\n            UnityEditor.EditorApplication.isPlaying = false;\n            #endif\n        }\n    }\n    <\/code><\/pre>\n<p>The above code provides the functionality to exit the game when leaving the room and also handles testing in editor mode.<\/p>\n<h3>4.3 Connecting the Exit Functionality to the Button<\/h3>\n<p>Connect the <code>ExitGame<\/code> script to the button to activate the functionality of exiting when clicked. Select the button and set the On Click() event in the inspector to connect with the <code>ExitRoom<\/code> method of the <code>ExitGame<\/code> script.<\/p>\n<h2>5. Comprehensive Testing<\/h2>\n<p>Once all setups are complete, run the game to test if the functionality works correctly. Check if the ending screen appears and if each function operates upon button clicks. If everything works well, you have successfully implemented the ending screen and exit functionality in Unity!<\/p>\n<h2>6. Conclusion and Tips<\/h2>\n<p>Through this tutorial, you have learned how to implement a simple ending screen and exit functionality in Unity. Consider the following:<\/p>\n<ul>\n<li>Enhance UI design by adding animation effects.<\/li>\n<li>You can display various ending messages based on the game result.<\/li>\n<li>Consider adding features to record and display the player&#8217;s score or achievements.<\/li>\n<\/ul>\n<div class=\"note\">\n<strong>Note:<\/strong> Feel free to test and modify to create your own unique ending screen!\n<\/div>\n<p>This concludes the Unity basics tutorial on creating an ending screen and exit functionality. I hope it helps you in your game development journey!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello! In this tutorial, we will explore how to create an ending screen after making a game in Unity and implement the exit functionality. This tutorial is aimed at those with a basic understanding of Unity and will proceed step by step. Each step will include necessary code examples and explanations. 1. Course Overview This &hellip; <a href=\"https:\/\/atmokpo.com\/w\/31817\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Unity Basics Course: Creating an Ending Screen and Exiting the 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-31817","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: Creating an Ending Screen and Exiting the 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\/31817\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity Basics Course: Creating an Ending Screen and Exiting the Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Hello! In this tutorial, we will explore how to create an ending screen after making a game in Unity and implement the exit functionality. This tutorial is aimed at those with a basic understanding of Unity and will proceed step by step. Each step will include necessary code examples and explanations. 1. Course Overview This &hellip; \ub354 \ubcf4\uae30 &quot;Unity Basics Course: Creating an Ending Screen and Exiting the Room&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/31817\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:03:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:34:34+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\/31817\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31817\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Unity Basics Course: Creating an Ending Screen and Exiting the Room\",\"datePublished\":\"2024-11-01T09:03:12+00:00\",\"dateModified\":\"2024-11-01T11:34:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31817\/\"},\"wordCount\":698,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Unity Basic\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/31817\/\",\"url\":\"https:\/\/atmokpo.com\/w\/31817\/\",\"name\":\"Unity Basics Course: Creating an Ending Screen and Exiting the Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:03:12+00:00\",\"dateModified\":\"2024-11-01T11:34:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31817\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/31817\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/31817\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity Basics Course: Creating an Ending Screen and Exiting the 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: Creating an Ending Screen and Exiting the 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\/31817\/","og_locale":"ko_KR","og_type":"article","og_title":"Unity Basics Course: Creating an Ending Screen and Exiting the Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Hello! In this tutorial, we will explore how to create an ending screen after making a game in Unity and implement the exit functionality. This tutorial is aimed at those with a basic understanding of Unity and will proceed step by step. Each step will include necessary code examples and explanations. 1. Course Overview This &hellip; \ub354 \ubcf4\uae30 \"Unity Basics Course: Creating an Ending Screen and Exiting the Room\"","og_url":"https:\/\/atmokpo.com\/w\/31817\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:03:12+00:00","article_modified_time":"2024-11-01T11:34:34+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\/31817\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/31817\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Unity Basics Course: Creating an Ending Screen and Exiting the Room","datePublished":"2024-11-01T09:03:12+00:00","dateModified":"2024-11-01T11:34:34+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/31817\/"},"wordCount":698,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Unity Basic"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/31817\/","url":"https:\/\/atmokpo.com\/w\/31817\/","name":"Unity Basics Course: Creating an Ending Screen and Exiting the Room - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:03:12+00:00","dateModified":"2024-11-01T11:34:34+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/31817\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/31817\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/31817\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Unity Basics Course: Creating an Ending Screen and Exiting the 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\/31817","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=31817"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31817\/revisions"}],"predecessor-version":[{"id":31818,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31817\/revisions\/31818"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=31817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=31817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=31817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}