{"id":32025,"date":"2024-11-01T09:05:04","date_gmt":"2024-11-01T09:05:04","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32025"},"modified":"2024-11-01T11:33:38","modified_gmt":"2024-11-01T11:33:38","slug":"unity-basics-course-creating-and-deleting-components","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32025\/","title":{"rendered":"Unity Basics Course: Creating and Deleting Components"},"content":{"rendered":"<p>\n    Unity is one of the modern game development environments that provides a powerful engine to create games usable on various platforms. In this tutorial, we will delve into the creation and deletion of components, which is one of the most fundamental and important concepts in Unity.\n<\/p>\n<h2>1. What is a Component in Unity?<\/h2>\n<p>\n    A component is an element that is added to Unity&#8217;s game objects, defining the behavior and appearance of that object. All functionalities in Unity are implemented through these components. Components can take various forms such as scripts, physics engines, animations, and audio.\n<\/p>\n<h2>2. Types of Components<\/h2>\n<p>\n    Components can be broadly categorized into two types:\n<\/p>\n<ul>\n<li><strong>Standard Components<\/strong>: Basic components provided by default, such as Transform, Camera, Light, etc.<\/li>\n<li><strong>Custom Components<\/strong>: Components created from scripts written by the user.<\/li>\n<\/ul>\n<h2>3. Creating Components<\/h2>\n<p>\n    Creating a component is very simple. You can add a new component with just a few clicks in the Unity Editor. Follow the steps below.\n<\/p>\n<ol>\n<li>Select the game object.<\/li>\n<li>Click the &#8220;Add Component&#8221; button in the Inspector panel.<\/li>\n<li>Search for the desired component or select it from the list.<\/li>\n<\/ol>\n<p>\n    For example, adding a &#8220;Rigidbody&#8221; component allows the game object to move under the influence of the physics engine.\n<\/p>\n<h3>3.1 Creating Custom Script Components<\/h3>\n<p>\n    To use a custom script as a component, you need to create a C# script. Here\u2019s how to create a custom script in Unity:\n<\/p>\n<ol>\n<li>Right-click on the &#8220;Assets&#8221; folder in the Project panel.<\/li>\n<li>Select &#8220;Create&#8221; &gt; &#8220;C# Script&#8221;.<\/li>\n<li>Enter a name for the script and double-click to open it in an IDE like Visual Studio.<\/li>\n<li>Create a class that inherits from <strong>MonoBehaviour<\/strong> and implement the Start() and Update() methods.<\/li>\n<\/ol>\n<p>\n    Below is an example of a simple custom component:\n<\/p>\n<pre><code>using UnityEngine;\n\npublic class MyComponent : MonoBehaviour {\n    void Start() {\n        Debug.Log(\"Component has started!\");\n    }\n\n    void Update() {\n        transform.Rotate(0, 100 * Time.deltaTime, 0);\n    }\n}<\/code><\/pre>\n<h3>3.2 Creating Components via Code<\/h3>\n<p>\n    You can also add components at runtime through scripts. This is done using the AddComponent method. Below is an example code:\n<\/p>\n<pre><code>void Start() {\n    gameObject.AddComponent<Rigidbody>();\n}<\/code><\/pre>\n<h2>4. Deleting Components<\/h2>\n<p>\n    The process of deleting a component is also very intuitive. Here\u2019s how to remove a component:\n<\/p>\n<ol>\n<li>Find the component you want to delete in the Inspector panel.<\/li>\n<li>Click the gear icon in the top right corner of the component.<\/li>\n<li>Select &#8220;Remove Component&#8221;.<\/li>\n<\/ol>\n<h3>4.1 Deleting Components via Code<\/h3>\n<p>\n    It is also possible to remove components at runtime through scripts. Refer to the example code below:\n<\/p>\n<pre><code>void Start() {\n    Destroy(GetComponent<Rigidbody>());\n}<\/code><\/pre>\n<h2>5. Managing Components<\/h2>\n<p>\n    Efficient management of various components is essential in Unity. Separating and combining components to compose game objects is the optimal approach.\n<\/p>\n<h2>6. Performance Optimization Tips<\/h2>\n<p>\n    Adding many components can affect the performance of the game. To avoid this, it&#8217;s advisable to refrain from frequent creation and deletion, and instead enable or disable components only when necessary.\n<\/p>\n<h2>7. Conclusion<\/h2>\n<p>\n    In this tutorial, we explored how to create and delete components in Unity. Components are a core element of Unity, so understand and utilize them well to create your own game.\n<\/p>\n<p>\n    If you have any additional questions or curiosities, please leave a comment!\n<\/p>\n<h2>8. References<\/h2>\n<ul>\n<li><a href=\"https:\/\/docs.unity3d.com\/Manual\/UnityAPI.html\">Unity API Documentation<\/a><\/li>\n<li><a href=\"https:\/\/learn.unity.com\/\">Unity Learn<\/a><\/li>\n<li><a href=\"https:\/\/www.youtube.com\/c\/Unity3D\">Unity YouTube Channel<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Unity is one of the modern game development environments that provides a powerful engine to create games usable on various platforms. In this tutorial, we will delve into the creation and deletion of components, which is one of the most fundamental and important concepts in Unity. 1. What is a Component in Unity? A component &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32025\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Unity Basics Course: Creating and Deleting Components&#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-32025","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 and Deleting Components - \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\/32025\/\" \/>\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 and Deleting Components - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Unity is one of the modern game development environments that provides a powerful engine to create games usable on various platforms. In this tutorial, we will delve into the creation and deletion of components, which is one of the most fundamental and important concepts in Unity. 1. What is a Component in Unity? A component &hellip; \ub354 \ubcf4\uae30 &quot;Unity Basics Course: Creating and Deleting Components&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32025\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:05:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:33:38+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=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32025\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32025\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Unity Basics Course: Creating and Deleting Components\",\"datePublished\":\"2024-11-01T09:05:04+00:00\",\"dateModified\":\"2024-11-01T11:33:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32025\/\"},\"wordCount\":491,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Unity Basic\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32025\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32025\/\",\"name\":\"Unity Basics Course: Creating and Deleting Components - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:05:04+00:00\",\"dateModified\":\"2024-11-01T11:33:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32025\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32025\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32025\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity Basics Course: Creating and Deleting Components\"}]},{\"@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 and Deleting Components - \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\/32025\/","og_locale":"ko_KR","og_type":"article","og_title":"Unity Basics Course: Creating and Deleting Components - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Unity is one of the modern game development environments that provides a powerful engine to create games usable on various platforms. In this tutorial, we will delve into the creation and deletion of components, which is one of the most fundamental and important concepts in Unity. 1. What is a Component in Unity? A component &hellip; \ub354 \ubcf4\uae30 \"Unity Basics Course: Creating and Deleting Components\"","og_url":"https:\/\/atmokpo.com\/w\/32025\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:05:04+00:00","article_modified_time":"2024-11-01T11:33:38+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":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32025\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32025\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Unity Basics Course: Creating and Deleting Components","datePublished":"2024-11-01T09:05:04+00:00","dateModified":"2024-11-01T11:33:38+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32025\/"},"wordCount":491,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Unity Basic"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32025\/","url":"https:\/\/atmokpo.com\/w\/32025\/","name":"Unity Basics Course: Creating and Deleting Components - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:05:04+00:00","dateModified":"2024-11-01T11:33:38+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32025\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32025\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32025\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Unity Basics Course: Creating and Deleting Components"}]},{"@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\/32025","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=32025"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32025\/revisions"}],"predecessor-version":[{"id":32026,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32025\/revisions\/32026"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}