{"id":32059,"date":"2024-11-01T09:05:20","date_gmt":"2024-11-01T09:05:20","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32059"},"modified":"2024-11-01T11:33:30","modified_gmt":"2024-11-01T11:33:30","slug":"unity-basics-course-implementing-shooting-functionality","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32059\/","title":{"rendered":"Unity Basics Course: Implementing Shooting Functionality"},"content":{"rendered":"<p>Hello! In this blog post, I will explain in detail how to implement shooting functionality using the Unity engine. This tutorial will be beneficial for everyone, from those who are new to Unity to those who want to revisit the basics. We will proceed step by step, providing both code and explanations along the way. The goal of this tutorial is to understand and implement the basic shooting mechanics for a simple 2D or 3D shooting game.<\/p>\n<h2>1. Installing Unity and Basic Setup<\/h2>\n<p>To use Unity, you first need to install Unity Hub. Unity Hub is useful for managing multiple Unity projects and installing and updating various versions of the Unity engine.<\/p>\n<ol>\n<li>Download and install Unity Hub.<\/li>\n<li>After running Unity Hub, install the required Unity version. The recommended version is the latest LTS (Long Term Support) version.<\/li>\n<li>Once installed, create a new 3D or 2D project.<\/li>\n<\/ol>\n<h2>2. Understanding the Project Structure<\/h2>\n<p>A Unity project consists of various folders. The &#8216;Assets&#8217; folder is where we store our resources (scripts, images, audio, etc.). The &#8216;Scenes&#8217; folder stores the scenes, where each scene represents a stage or level of the game.<\/p>\n<h2>3. Creating a Basic Scene<\/h2>\n<p>First, let&#8217;s create a basic scene. We will add a simple plane to create a space for the player to shoot.<\/p>\n<ol>\n<li>Right-click in the Hierarchy view and select &#8216;3D Object&#8217; &gt; &#8216;Plane&#8217; to add a plane.<\/li>\n<li>Adjust the Scale of the Plane to create a larger space.<\/li>\n<li>Adjust the position of the Camera to face the plane.<\/li>\n<\/ol>\n<h2>4. Creating the Player Character<\/h2>\n<p>To create the player character, we will add a new 3D object. Here, we will use a simple cube to represent the player.<\/p>\n<ol>\n<li>Right-click in the Hierarchy view and select &#8216;3D Object&#8217; &gt; &#8216;Cube&#8217; to add a cube.<\/li>\n<li>Adjust the Scale of the Cube to (1, 2, 1) to shape it like the player.<\/li>\n<li>Name the Cube &#8216;Player&#8217;.<\/li>\n<li>Set the Y-axis of the Cube appropriately so that it is placed above the plane when the application runs (e.g., Y=1).<\/li>\n<\/ol>\n<h2>5. Implementing the Shooting Functionality<\/h2>\n<p>Now, let&#8217;s create a bullet that the player can shoot and implement the shooting functionality for it.<\/p>\n<h3>5.1. Creating the Bullet Prefab<\/h3>\n<p>To implement the bullet, let&#8217;s create a bullet prefab using a new cube.<\/p>\n<ol>\n<li>Add a new &#8216;Cube&#8217; in the Hierarchy and name it &#8216;Bullet&#8217;.<\/li>\n<li>Adjust the Scale of the Bullet to (0.2, 0.2, 0.5) to shape it like a bullet.<\/li>\n<li>Add a Rigidbody component to the Bullet to enable physics.<\/li>\n<li>To make the Bullet a Prefab, drag the Bullet object into the &#8216;Assets&#8217; folder.<\/li>\n<li>Now delete the Bullet Prefab from the Hierarchy.<\/li>\n<\/ol>\n<h3>5.2. Writing the Script<\/h3>\n<p>Now, we will write a script to allow the player to shoot. Create a new C# script in the &#8216;Assets&#8217; folder and name it &#8216;PlayerController.cs&#8217;. Let&#8217;s write the following code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello! In this blog post, I will explain in detail how to implement shooting functionality using the Unity engine. This tutorial will be beneficial for everyone, from those who are new to Unity to those who want to revisit the basics. We will proceed step by step, providing both code and explanations along the way. &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32059\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Unity Basics Course: Implementing Shooting Functionality&#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-32059","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: Implementing Shooting Functionality - \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\/32059\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity Basics Course: Implementing Shooting Functionality - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Hello! In this blog post, I will explain in detail how to implement shooting functionality using the Unity engine. This tutorial will be beneficial for everyone, from those who are new to Unity to those who want to revisit the basics. We will proceed step by step, providing both code and explanations along the way. &hellip; \ub354 \ubcf4\uae30 &quot;Unity Basics Course: Implementing Shooting Functionality&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32059\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:05:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:33:30+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=\"2\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32059\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32059\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Unity Basics Course: Implementing Shooting Functionality\",\"datePublished\":\"2024-11-01T09:05:20+00:00\",\"dateModified\":\"2024-11-01T11:33:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32059\/\"},\"wordCount\":466,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Unity Basic\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32059\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32059\/\",\"name\":\"Unity Basics Course: Implementing Shooting Functionality - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:05:20+00:00\",\"dateModified\":\"2024-11-01T11:33:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32059\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32059\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32059\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity Basics Course: Implementing Shooting Functionality\"}]},{\"@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: Implementing Shooting Functionality - \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\/32059\/","og_locale":"ko_KR","og_type":"article","og_title":"Unity Basics Course: Implementing Shooting Functionality - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Hello! In this blog post, I will explain in detail how to implement shooting functionality using the Unity engine. This tutorial will be beneficial for everyone, from those who are new to Unity to those who want to revisit the basics. We will proceed step by step, providing both code and explanations along the way. &hellip; \ub354 \ubcf4\uae30 \"Unity Basics Course: Implementing Shooting Functionality\"","og_url":"https:\/\/atmokpo.com\/w\/32059\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:05:20+00:00","article_modified_time":"2024-11-01T11:33:30+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":"2\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32059\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32059\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Unity Basics Course: Implementing Shooting Functionality","datePublished":"2024-11-01T09:05:20+00:00","dateModified":"2024-11-01T11:33:30+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32059\/"},"wordCount":466,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Unity Basic"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32059\/","url":"https:\/\/atmokpo.com\/w\/32059\/","name":"Unity Basics Course: Implementing Shooting Functionality - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:05:20+00:00","dateModified":"2024-11-01T11:33:30+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32059\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32059\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32059\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Unity Basics Course: Implementing Shooting Functionality"}]},{"@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\/32059","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=32059"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32059\/revisions"}],"predecessor-version":[{"id":32060,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32059\/revisions\/32060"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}