<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dev Rayda</title>
    <description>The latest articles on DEV Community by Dev Rayda (@devrayda).</description>
    <link>https://dev.to/devrayda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F836569%2F5a76e794-9a4c-4594-adcd-bfc2b8e75610.jpg</url>
      <title>DEV Community: Dev Rayda</title>
      <link>https://dev.to/devrayda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devrayda"/>
    <language>en</language>
    <item>
      <title>How to Publish Your Unity Game to Google Play</title>
      <dc:creator>Dev Rayda</dc:creator>
      <pubDate>Fri, 12 Aug 2022 16:20:00 +0000</pubDate>
      <link>https://dev.to/devrayda/how-to-publish-your-unity-game-to-google-play-17fg</link>
      <guid>https://dev.to/devrayda/how-to-publish-your-unity-game-to-google-play-17fg</guid>
      <description>&lt;p&gt;This article was originally published on the Sentry blog &lt;a href="https://blog.sentry.io/2022/08/10/how-to-publish-your-unity-game-to-google-play/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For this tutorial, we will publish the “Tap (Frog)” game I developed in my previous Unity series, which you can explore &lt;a href="https://dev.to/devrayda"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You need to have a &lt;a href="https://play.google.com/console/u/0/signup/playSignup"&gt;Google developer account&lt;/a&gt; (which requires one-time payment of $25). After setting up your account, you can start adding and publishing your applications to Google Play. Before doing so, let’s prepare your game for publishing.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prepare your game
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Landscape Orientation
&lt;/h2&gt;

&lt;p&gt;The “Tap (Frog)” game we developed is currently in landscape mode. Meaning, if a player were to rotate their phone, the game would automatically rotate and the player wouldn’t be able to play properly as the game screen would be cropped. To fix this issue, we want to adjust the game’s orientation to landscape only.&lt;/p&gt;

&lt;p&gt;Open the game in Unity, click on File &amp;gt; Build Settings. Select “Android” as shown in the image below since we want to publish this game on an Android platform:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qk8alD10--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zcu9z01di9vfy3onl5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qk8alD10--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zcu9z01di9vfy3onl5l.png" alt="Image description" width="880" height="883"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, click on Player Settings &amp;gt; Resolution and Presentation. Scroll down until you find “Allowed Orientations for Auto Rotation”. Uncheck “Portrait” and “Portrait Upside Down”. The game is now locked to a landscape orientation only.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jKmWo_Wa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ib161aqjw95w25n8czj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jKmWo_Wa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ib161aqjw95w25n8czj.png" alt="Image description" width="880" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Switching to Android Platform
&lt;/h2&gt;

&lt;p&gt;The default for a Unity game is “PC, Mac &amp;amp; Linux Standalone”, so we need to switch to the Android platform. Return to the build settings window and click on Switch platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--osyQ6Eds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ukpn9d61l3eu7tufj6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--osyQ6Eds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ukpn9d61l3eu7tufj6l.png" alt="Image description" width="880" height="883"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Player settings
&lt;/h2&gt;

&lt;p&gt;Let’s return to the Player Settings and finish setting up the application. First, write the “Company Name” and “Product Name” as shown below. You won’t be able to change these after you upload the game, so make sure you’re pleased with your name(s).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VMd5h4KM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kblktcdyoaq5srq3yugi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VMd5h4KM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kblktcdyoaq5srq3yugi.png" alt="Image description" width="880" height="770"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you need to add the game icon which will appear on the user’s phone. You can either add one icon in the “Default Icon” field and it will resize automatically for the rest of the sizes, or you can click on “Icon” below and fill all the sizes for the different Android versions under Adaptive, Round and Legacy. Google requires the application icon to be 512 x 512 px, so this is what we will upload in the “Default Icon” field, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9oXIaslG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw6s4887dkn6e7zxqmm8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9oXIaslG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw6s4887dkn6e7zxqmm8.png" alt="Image description" width="880" height="770"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Publishing Settings
&lt;/h2&gt;

&lt;p&gt;Scroll down to “Publishing Settings” in the same window and click on “KeyStore Manager”. A keystore is a container file for keys used to sign the applications that identifies you as the developer. You will need a key and password for this.&lt;/p&gt;

&lt;p&gt;Let’s create a keystore by clicking on the Keystore dropdown &amp;gt; Create New, and save somewhere for referencing later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N4N044QD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ac150g53jqbc1vi7j76x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N4N044QD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ac150g53jqbc1vi7j76x.png" alt="Image description" width="880" height="861"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, setup and confirm passwords, and an alias, as shown below, before clicking on “Add key”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fCwiVpRx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fygd1etl9a86n89gz206.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fCwiVpRx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fygd1etl9a86n89gz206.png" alt="Image description" width="880" height="861"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A confirmation window will popup; click yes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--APvDN2hS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgksostpobuxkopm57i7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--APvDN2hS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgksostpobuxkopm57i7.png" alt="Image description" width="520" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we can build the application. Head back to the build settings window and check “Build App Bundle (Google Play)” as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p0W8iw5F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k87jwguxdsqpd5xccnsp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p0W8iw5F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k87jwguxdsqpd5xccnsp.png" alt="Image description" width="880" height="880"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on “Build” in the build settings window. When the build is done, you will have a file with an .aab extension. You’re now ready to upload your application to the Google Play Store.&lt;/p&gt;

&lt;h1&gt;
  
  
  Upload Your Application to Google Play Console
&lt;/h1&gt;

&lt;p&gt;Head over to the Google Play Console, click on “Create app”, and fill in all the necessary details for the app on the first page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3KmnBjyP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1f6mib8i87mpb6ftbo09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3KmnBjyP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1f6mib8i87mpb6ftbo09.png" alt="Image description" width="880" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before publishing, we’ll release our application for internal testing (you can test it with up to 100 internal testers).&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing your application
&lt;/h2&gt;

&lt;p&gt;There are three types of testing options in the console.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open Testing&lt;/strong&gt;, where anyone on Google Play can join and test your application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Closed Testing&lt;/strong&gt;, where you can release several versions of your application at the same time to test different features with a specific group of testers you choose.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Internal Testing&lt;/strong&gt;, where you test with up to 100 internal testers (this is what we’ll do).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Internal testing
&lt;/h2&gt;

&lt;p&gt;First, let’s create a release for internal testing and add yourself as a tester so you can test it yourself. Feel free to add additional testers to this track. Select “Internal testing” from the side menu, then click on “Select testers”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ObCik-Kw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yejepm4c6nqlmqdbwu92.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ObCik-Kw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yejepm4c6nqlmqdbwu92.png" alt="Image description" width="880" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll create an email list of our testers, or upload via a .csv file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HzJKLXvP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzqiv6xfjmlpgc992naj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HzJKLXvP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzqiv6xfjmlpgc992naj.png" alt="Image description" width="880" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mzDySqjH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqnd067pvn1gou4jpgj8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mzDySqjH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqnd067pvn1gou4jpgj8.png" alt="Image description" width="880" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few more setting changes before uploading our game:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In your Build Settings &amp;gt; Player Settings, change the “Target API Level” to “Android 11.0 (API Level 30)”. You may need to update your Android SDK to API level 30. Each time you upload a new app bundle, make sure you increase the “version” from the Build Settings &amp;gt; Player Settings window. Otherwise, you’ll encounter an error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;While in your build settings, change the scripting backend from “Mono” to “IL2CPP”. In short, Mono is a better setting for iterative development, but if you care about performance, IL2CPP is the choice. Plus, the Google Play Store requires this for upload.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lastly, check “ARM64” to make the game available on 64-bit devices.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now click “Create new release”, where we can upload our application bundle build file, name the release, and write in any release notes.&lt;/p&gt;

&lt;p&gt;If everything looks good and the upload was successful, “Save” then “Review Release” as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7njYhLqN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgdi1w7gyq7zbphj2bj9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7njYhLqN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgdi1w7gyq7zbphj2bj9.png" alt="Image description" width="880" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next we’ll roll-out internal testing&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RXrUBLN5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrg63gi1vagx8gk9fk11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RXrUBLN5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrg63gi1vagx8gk9fk11.png" alt="Image description" width="880" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Head to the testers tab, select the testers, copy that link, and open the link from your Android test device to begin testing your application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kWZU2-cT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qyhswvtlo7b6w6hfok8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kWZU2-cT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qyhswvtlo7b6w6hfok8.png" alt="Image description" width="880" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  The Dashboard
&lt;/h1&gt;

&lt;p&gt;From the dashboard page, you can publish your store listing before you release the game and let users pre-register for your application. They will get a notification to download when your application is available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t542eFP9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccm4f48oroou9wd0g5yi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t542eFP9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccm4f48oroou9wd0g5yi.png" alt="Image description" width="880" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up your application’s content
&lt;/h2&gt;

&lt;p&gt;On the dashboard page under “Set up your app”, there are tasks you need to complete. Finish these tasks and your application will be ready to be published.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U7WQpi3a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5a8fhaxxrzaonjukw6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U7WQpi3a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5a8fhaxxrzaonjukw6t.png" alt="Image description" width="880" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you finish testing and have setup your applications’s content, you are ready to create a release and publish to Google Play. Bear in mind that Google will take a few days to review your application and if there are any &lt;a href="https://www.youtube.com/watch?v=ZDS4diFfBmQ&amp;amp;ab_channel=AndroidDevelopers"&gt;issues&lt;/a&gt; you’ll be notified about what to fix before submitting again.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unity Tutorial: Developing Your First Unity Game - Part 3</title>
      <dc:creator>Dev Rayda</dc:creator>
      <pubDate>Mon, 20 Jun 2022 09:19:26 +0000</pubDate>
      <link>https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-3-30bi</link>
      <guid>https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-3-30bi</guid>
      <description>&lt;p&gt;This article was originally published on the Sentry blog &lt;a href="https://blog.sentry.io/2022/06/14/unity-tutorial-developing-your-first-unity-game-part-3/?utm_source=DevTo&amp;amp;utm_medium=referral&amp;amp;utm_campaign=unity-game-part-3-rayda"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Welcome to the final article in this Unity series where we are developing a Unity game. You can check out my intro article, where I dive into &lt;a href="https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk"&gt;Unity editor basics&lt;/a&gt;, or dive right into &lt;a href="https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-1-3km3"&gt;part 1 of our “Developing your first Unity game”&lt;/a&gt;, where we begin developing our Frog Unity game and I dig a bit deeper into a couple important game object components, and then &lt;a href="https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-2-3clo"&gt;part 2 of our “Developing your first Unity Game”&lt;/a&gt;, where I walk-through adding a falling effect, instantiating several prefabs in random places, &amp;amp; making and displaying a score counter.&lt;/p&gt;

&lt;p&gt;In this article, we are going to create a main menu, add sounds to the game, animate buttons, pause, &amp;amp; finally, exit the game.&lt;/p&gt;

&lt;p&gt;The following should be installed on your computer to follow along this tutorial:&lt;/p&gt;

&lt;p&gt;Unity Unity Hub Visual Studio&lt;/p&gt;

&lt;p&gt;In this tutorial, Unity Version “2020.3.23f1” is used.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a main menu
&lt;/h2&gt;

&lt;p&gt;To create a main menu for our game, we can add a new scene or create a popup window in the same scene. I personally prefer adding a new scene because the larger the game becomes &amp;amp; the more game objects you have in a scene, the heavier the scene is. You will have the opportunity to add more features to the game later.&lt;/p&gt;

&lt;p&gt;Let’s add a new scene and name it “Menu”. We will use the same background we used in the game scene. Return to the TapGame scene and copy the canvas and the EventSystem from the hierarchy, and paste it in the “Menu” scene as shown below. This will save us a lot of time. If we want, we can edit the background image later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6MPrWLUn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9xy0koyr64y8amf1hhm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6MPrWLUn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9xy0koyr64y8amf1hhm.gif" alt="Image description" width="600" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HWpWnWo0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rj59vgj0gnxxv5xljm7x.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HWpWnWo0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rj59vgj0gnxxv5xljm7x.gif" alt="Image description" width="600" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we have the same background image, but we need to center it. Do so by adding the Main Camera in the Render Camera field in the inspector of the canvas (as shown below):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--td39bVTH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cykdl0cyeus4dnbuutys.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--td39bVTH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cykdl0cyeus4dnbuutys.gif" alt="Image description" width="800" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since we don’t need the text object inside the canvas object, we can delete it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YmCp0fum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adc04qs6k0oe6n83y2uo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YmCp0fum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adc04qs6k0oe6n83y2uo.png" alt="Image description" width="766" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we’re ready to make the main menu scene. First, let’s add an image for the game’s name. Drag the image from your assets folder and drop it into the hierarchy as shown below. Move the image towards the top-center part of the scene:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AvQV3_3t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dqidxvawgah8vf5ivcp5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AvQV3_3t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dqidxvawgah8vf5ivcp5.gif" alt="Image description" width="600" height="1081"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll next add a play button that will take players to the game scene so they can start playing. To do so, right click in the hierarchy, add a button, and name it “Play”. You can either add an image as a sprite for the button and delete the text object as shown in the image below, or use it as it is. I will use a play button image and delete the text object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UUOt7cjM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuazeexz0sjpxup8ne9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UUOt7cjM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuazeexz0sjpxup8ne9p.png" alt="Image description" width="838" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The game should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pUPZ86kQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/buepmd84wi4vo2oij4f7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pUPZ86kQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/buepmd84wi4vo2oij4f7.png" alt="Image description" width="880" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we’ll animate our play button.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to animate buttons
&lt;/h2&gt;

&lt;p&gt;Unity has a great animation tool which we’re going to use on the play button we just added. We can change a lot of properties for the button; for example, rect Transform properties, image properties, or button properties. We will scale the play button down, then scale back to its original size when it’s clicked to create the effect that we’ve pressed and released. After the animation ends, we want players to enter the game scene.&lt;/p&gt;

&lt;p&gt;To add an animation to a button, simply open the animation tool from Window &amp;gt; Animation &amp;gt; Animation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--umJeaRqX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3m9yd81739sfpltjoxtc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--umJeaRqX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3m9yd81739sfpltjoxtc.png" alt="Image description" width="880" height="929"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While the play button is selected in the hierarchy, click on create in the Animation tab that opens and change the name to “playButton”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lRVKhfR5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb23kiwv5oc99m6gmdwp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lRVKhfR5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb23kiwv5oc99m6gmdwp.png" alt="Image description" width="880" height="870"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An animator component, which is the controller of the animation, will be added automatically into the button object. Add a scale property to the animation as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LseLSZm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3t1256rt9gold6e0ymm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LseLSZm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3t1256rt9gold6e0ymm.png" alt="Image description" width="880" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s make the animation duration 0.10 seconds long since we don’t want too long of a time gap between the button click and the action, which is transitioning to the game scene; but feel free to increase or decrease the animation duration to a value you prefer.&lt;/p&gt;

&lt;p&gt;Next we need to create a clicking effect. To do so, we will reduce the scale value by 50% to 0.05 seconds so that the first half of the duration, the button’s size decreases, and the second half of the duration, the button’s size returns to its original size. To do that, copy the keys (the four small diamond shapes) and paste them at the 0.05 and 0.10 second intervals. Those keys we just pasted will change the details of the property. Now we can change the scale of the button to get the animation we desire. To do so, select the keys at the 0.05 second interval, which is half the animation duration, and change the scale value for x &amp;amp; y from 1.5 to 1.0 as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--clx0OuRo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyuuv5rmzn9sfwsc8bx7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--clx0OuRo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyuuv5rmzn9sfwsc8bx7.gif" alt="Image description" width="600" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The animation will loop and start immediately after we click the play button. However, we don’t want the animation to loop; we just want it to play once. We also want to jump to the game scene after the animation ends. To do so, we need to create some transitions, so let’s double click on the play controller in the inspector as shown below and get started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7oxLgji---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uldsb538cpw7fq6vldtk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7oxLgji---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uldsb538cpw7fq6vldtk.png" alt="Image description" width="880" height="1355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The animator controller window will open, &amp;amp; we can change when the animation will be activated. Right-click in the animator window and add a new state. Then, make two transitions from (and to) the new state &amp;amp; the playButton animation so that we can control the animation with these two transitions. Finally, since we don’t want the animation to start immediately when we start the scene (we only need it to start when we click on the button) we will set the new state as the default state:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F0fCdgRR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgwluzsb6807az2aaol5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F0fCdgRR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgwluzsb6807az2aaol5.gif" alt="Image description" width="600" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, since we want the animation to begin when we click, we need to send a signal or make a clicking event, and to do so, we need to add a trigger (which we’ll name “Active”) to the transition from the new state to the playButton state. This will trigger the animation to start. To transition from the new state to the animated state, uncheck the “has exit time” checkbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y2qXeoqd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10x1hcc26vkd8w1ncknh.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y2qXeoqd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10x1hcc26vkd8w1ncknh.gif" alt="Image description" width="600" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll then need to activate the trigger by writing a C# script, which we’ll name “Play”, and attaching it to the play button. Write the following code in the file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K9BnD6IS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/608nuyebssfnjou7fiei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K9BnD6IS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/608nuyebssfnjou7fiei.png" alt="Image description" width="880" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s run the game and click on the play button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dP9n9BiH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xbnuiudi6g01fc6yg7be.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dP9n9BiH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xbnuiudi6g01fc6yg7be.gif" alt="Image description" width="600" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It doesn’t do anything (yet) after the animation ends. So we need to write a script that will take us to the game scene. In the “Play” script, add the following code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YuLx_Zsj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21wcb0ta80c8rjqofgxy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YuLx_Zsj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21wcb0ta80c8rjqofgxy.png" alt="Image description" width="880" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To complete this feature, we need to add an event to the final step of the animation. Return to the animation window and add an event at the 0.10 second interval and select the function “PlayGameScene” as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aa0_DB34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekxzna4w7vlcz9w9f1es.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aa0_DB34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekxzna4w7vlcz9w9f1es.gif" alt="Image description" width="600" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A3UqNAtS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqmkku5atnu52o2r8no0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A3UqNAtS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqmkku5atnu52o2r8no0.gif" alt="Image description" width="600" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Play the game and see what happens. You’ll notice an error occurring:&lt;/p&gt;

&lt;p&gt;“Scene ‘TapGame’ couldn’t be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.”&lt;/p&gt;

&lt;p&gt;So, to move from scene to scene, all the scenes should be added to the build settings. To do so, click on File &amp;gt; Build Settings &amp;gt; Add Open Scenes as shown below. (If the TapGame scene is already open, it will be added. If not, make sure to open it and add it.:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FQLQzlV5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnpnm1rvszrsofvlrgmz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FQLQzlV5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnpnm1rvszrsofvlrgmz.gif" alt="Image description" width="600" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now play the game one more time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p3BEaolz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uujedljrfoq72ugwb16z.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p3BEaolz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uujedljrfoq72ugwb16z.gif" alt="Image description" width="600" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have a functioning play button that transitions us right into the game.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pause Feature
&lt;/h2&gt;

&lt;p&gt;Jumping back into the game scene, we need to be able to pause the game (open a pop-up window) and then resume playing. Let’s first add the UI elements for this feature.&lt;/p&gt;

&lt;p&gt;Add the pause button to the top right of the scene exactly like we did with the play button in the menu scene. It should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KbmPiQDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3wwlaemj8jdnccryce6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KbmPiQDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3wwlaemj8jdnccryce6.png" alt="Image description" width="880" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we will make the UI for the pause pop-up window. We need a dark background image the same size as the background image and with an opacity of ~80% so we can still see a little bit of the background as shown below. Let’s duplicate the background image in the scene and replace the image with the dark background image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Eyh7a23S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/krbp0k6galxrjm6yjj18.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Eyh7a23S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/krbp0k6galxrjm6yjj18.png" alt="Image description" width="880" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Continuing on, we need to add an image for the frame of the pause window. It needs to be an image, not a sprite. If you drag the frame image from the project assets into the hierarchy, it will be a sprite, and you won’t be able to add or see other content (for example, text or buttons). It should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wXeyf7ap--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/370sx6slg51dp875qosc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wXeyf7ap--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/370sx6slg51dp875qosc.png" alt="Image description" width="880" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next we’ll add text “Paused” to the top center of the frame to indicate the game is in a paused state, two buttons for users to “Resume” and “Exit”, and finally a third button to toggle sound on/off. It should look something like below, but the buttons won’t do anything until we write some functions. All the objects are children of the Frame game object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rk7jIp7m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1655656159692/D9LdqDqi4.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rk7jIp7m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1655656159692/D9LdqDqi4.png%2520align%3D%2522left%2522" alt="image.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to code these buttons. We’ll start with the pause button in the game scene. We want to pause playing the game, show the dark scene, and display our paused window. To pause the game, we need to add a condition to the IEnumerator in our “Spawn” script:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bqncPRga--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/go2k3f4ppb4p2ebue7ss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bqncPRga--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/go2k3f4ppb4p2ebue7ss.png" alt="Image description" width="880" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to write a “pause the game” function within the “Spawn” script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void PauseGame()
    {

        IsPause = 1;
        darkScreen.SetActive(true);
        frame.SetActive(true);

    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this function to OnClick() of the pause button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--11FJb0BK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dgdo18chzd71rwj06we2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--11FJb0BK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dgdo18chzd71rwj06we2.png" alt="Image description" width="714" height="976"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we try this code, make the public reference to the frame and the dark screen in the Spawn script as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jNQVZlaG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ashts4pe632bx000jrzi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jNQVZlaG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ashts4pe632bx000jrzi.png" alt="Image description" width="660" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then drag the dark screen object and the frame objects from the scene into the empty fields in the inspector for the Spawn script as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HXaE45Lo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o19ghl0w8h8m5iba9sl3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HXaE45Lo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o19ghl0w8h8m5iba9sl3.png" alt="Image description" width="724" height="1432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we play the game, the frogs that were already generated are still there after we press the pause button, and the frame is active. To fix this problem, we’ll simply destroy these frogs because it is faster and easier compared to keeping the same frogs, pausing their movement, maintaining their location, and continuing falling down the screen after we press resume.&lt;/p&gt;

&lt;p&gt;Let’s add a tag, “frog”, then destroy game objects with the tag “frog”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4gcQIJ59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/maiq5lakt7s8f88alv2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4gcQIJ59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/maiq5lakt7s8f88alv2m.png" alt="Image description" width="714" height="1314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Head back to the Spawn script we just updated and write the following code. to destroy the frogs already in the scene by finding the game objects with the “frog” tag we just added.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zZr2u2t0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4j5vlvomn0uo8293j33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zZr2u2t0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4j5vlvomn0uo8293j33.png" alt="Image description" width="880" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the resume button, we need to reverse what we did for the pause button; set the dark screen and the frame to be inactive, set isPause to 0, and start the coroutine again. Write the following code in the “Spawn” script…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void ResumeGame()
    {

        IsPause = 0;
        darkScreen.SetActive(false);
        frame.SetActive(false);
        StartCoroutine(spawningFrog());
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;…and add this function to OnClick() of the resume button. It should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CUBB20yE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cf96xbfx8j3avmfji645.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CUBB20yE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cf96xbfx8j3avmfji645.png" alt="Image description" width="714" height="976"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the exit button, we just want to go back to the menu scene. Load the menu scene as we did before (using the script below) and attach it to the exit button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mn3qpkW6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fz5ikmoqp1f1yz31bcyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mn3qpkW6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fz5ikmoqp1f1yz31bcyl.png" alt="Image description" width="880" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the inspector for the exit button, select the function from the drop down menu for the OnClick() as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZJRvOJ8x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/241lx6s43omub2da89fo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZJRvOJ8x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/241lx6s43omub2da89fo.gif" alt="Image description" width="600" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to check the pause &amp;amp; resume buttons. The experience should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qmIEw2oR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9158ej2f7zrm3hhxx5e.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qmIEw2oR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9158ej2f7zrm3hhxx5e.gif" alt="Image description" width="600" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding sound
&lt;/h2&gt;

&lt;p&gt;Before adding a sound button to toggle on/off, we need to first add sounds. Let’s add a sound when the frog explodes. You can search for free sounds for commercial use online or use files you’ve paid for already. Import the file into the assets folder once you’ve downloaded it.&lt;/p&gt;

&lt;p&gt;Next, attach the sound script to an empty game object and refer to the script when we need it. Create an empty game object and name it “SoundManagerObject”. Create a C# script, name it “SoundManager”, and attach it to the object created.&lt;/p&gt;

&lt;p&gt;We will write the following code in this script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using UnityEngine;
using UnityEngine.UI;

public class SoundManager : MonoBehaviour

{

    //A public variable for the audio source we just imported.
    public AudioSource explosionSound;

    //A variable to check whether the user wanted a sound or the user muted it.
    int IsSound;

    //References to the sound buttons and its two images.
    public Sprite soundImage;
    public Sprite noSoundImage;
    public Button SoundButton;

    // Start is called before the first frame update
    void Start()
    {
        //Get the sound value from the player preferences.
        IsSound = PlayerPrefs.GetInt("Sound", 1);

        //Check if the user wants a sound or not.
        if (IsSound == 1)
        {
            //Change its image
            SoundButton.GetComponent&amp;lt;Image&amp;gt;().sprite = soundImage;
        }
        else
        {
            //Change its image
            SoundButton.GetComponent&amp;lt;Image&amp;gt;().sprite = noSoundImage;
        }

    }

    public void playSound()
    {
        IsSound = PlayerPrefs.GetInt("Sound", 1);

        if (IsSound == 1)
        {
            //Play the explosion sound
            explosionSound.Play();

        }

    }
    public void muteSound()
    {
        //Reduce the volume to zero

        explosionSound.volume = 0;
    }

    public void unmuteSound()
    {
       //Raise the volume to one
        explosionSound.volume = 1;
    }

public void ToggleSound()
    {
        //Check if the sound is on, equal to 1
        if (IsSound == 1)
        {
            //Change the variable to zero and save it in preferences
            IsSound = 0;
            PlayerPrefs.SetInt("Sound", IsSound);
            PlayerPrefs.Save();
            SoundButton.GetComponent&amp;lt;Image&amp;gt;().sprite = noSoundImage;
            muteSound();

        }
        else
        {
            IsSound = 1;
            PlayerPrefs.SetInt("Sound", IsSound);
            PlayerPrefs.Save();
            SoundButton.GetComponent&amp;lt;Image&amp;gt;().sprite = soundImage;
            unmuteSound();
        }
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Up until this point the frogs haven’t made any sound when they explode, and our sound button cannot be used to mute/unmute. We need to toggle the sound button. Head to the sound button inspector and add the OnClick() function of “ToggleSound()” as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l5hbKJNt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ybzinxxh6mzmzppo3p9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l5hbKJNt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ybzinxxh6mzmzppo3p9.gif" alt="Image description" width="600" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only thing missing is an explosion sound when the frog explodes. To do so, we need to add the audio source component to the “SoundManagerObject” game object. Select it, add the “Audio source” component, and drag the sound file into the empty field as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dZCXto5P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5z60q8gvmniumm9p02e3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dZCXto5P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5z60q8gvmniumm9p02e3.png" alt="Image description" width="698" height="1398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, edit to the “KillFrog” script to play the sound when we click/destroy the frog. We will add the following code inside this script:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a3r1Sapv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oth1y0l1in2vid12dbmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a3r1Sapv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oth1y0l1in2vid12dbmh.png" alt="Image description" width="880" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our game is ready to play.&lt;/p&gt;

&lt;p&gt;I hope this 3 part series has been helpful as you begin developing more games in Unity. Thank you for reading and I hope you enjoy playing the frog game you just created.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unity Tutorial: Developing Your First Unity Game - Part 2</title>
      <dc:creator>Dev Rayda</dc:creator>
      <pubDate>Thu, 12 May 2022 17:56:41 +0000</pubDate>
      <link>https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-2-3clo</link>
      <guid>https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-2-3clo</guid>
      <description>&lt;p&gt;This article was originally published on the Sentry blog &lt;a href="https://blog.sentry.io/2022/05/09/unity-tutorial-developing-your-first-unity-game-part-2/?utm_source=DevTo&amp;amp;utm_medium=referral&amp;amp;utm_campaign=rayda-unity-tutorial-blog-3"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Welcome to the third article in my Unity series where we are developing a Unity game. You can check out my &lt;a href="https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk"&gt;intro article&lt;/a&gt;, where I dive into Unity editor basics, and then &lt;a href="https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-1-3km3"&gt;part 1 of our “Developing your first Unity game”,&lt;/a&gt; where we begin developing our Frog Unity game and I dig a bit deeper into a couple important game object components.&lt;/p&gt;

&lt;p&gt;In this article, we are going to walk-through how to add the falling effect, how to instantiate several prefabs in random places, &amp;amp; how to make a score counter (and display it) for our Frog game.&lt;/p&gt;

&lt;p&gt;The following should be installed on your computer to follow along this tutorial:&lt;/p&gt;

&lt;p&gt;Unity Unity Hub Visual Studio&lt;/p&gt;

&lt;p&gt;In this tutorial, Unity Version “2020.3.23f1” is used.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to add the falling effect to your Unity game
&lt;/h2&gt;

&lt;p&gt;Let’s say we want to add a water effect for when the frog falls into the lake. But the lake is a background image and we want the frog to be able to collide with the lake. To do so, we will simply create an empty object by right clicking in the hierarchy, and give it the name: “lake”. For a game object to collide with another, we need to add the “Box Collider 2D” component as I explained in my previous article (&lt;a href="https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-1-3km3"&gt;deep link&lt;/a&gt; for your convenience).&lt;/p&gt;

&lt;p&gt;We need to edit the collider to be located at the bottom of the scene and make it as wide as the scene (as shown in the image below):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PoeZNPe5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcp27fch0gu9n7dtq4dq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PoeZNPe5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcp27fch0gu9n7dtq4dq.png" alt="Image description" width="880" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s add a script so that when the frog collides with the lake game object it gets destroyed.&lt;/p&gt;

&lt;p&gt;Open the “KillFrog” script and write the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private void OnCollisionEnter2D(Collision2D collision)

    {
        Destroy(gameObject);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s save the code and run the game to check if the frog will get destroyed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9bIf0vLn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vn6x0h5k9lrnfr63gcbk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9bIf0vLn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vn6x0h5k9lrnfr63gcbk.gif" alt="Image description" width="600" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So far, so good. Now let’s instantiate the water effect for when the frog falls into the lake. As I introduced previously, we can visit the &lt;a href="https://assetstore.unity.com/"&gt;Unity Assets store&lt;/a&gt; and import the “Cartoon FX free” asset. For this, we will use the water effect. Open JMO Assets folder &amp;gt; CFX2 Prefabs folder &amp;gt; Water. We will do exactly as we did in my last article with the smoke effect, but we will write the code inside the OnCollisionEnter2D() function.&lt;/p&gt;

&lt;p&gt;Write the following code in the “KillFrog” script:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8Bk4lK7i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjv7atx1wjtb4uhnpdqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Bk4lK7i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjv7atx1wjtb4uhnpdqy.png" alt="Image description" width="880" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s drag and drop the water effect in the empty field in the inspector:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fjXmnltN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ducxx4efe6rw71tlz7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fjXmnltN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ducxx4efe6rw71tlz7l.png" alt="Image description" width="686" height="746"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to run the game again. As you can see, the frog is destroyed and there is a water splash effect when it nears the bottom.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GANiHmBN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0xfwf3wqrx92kyue3ey.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GANiHmBN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0xfwf3wqrx92kyue3ey.gif" alt="Image description" width="600" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above code we added will be problematic in the future; it will destroy the frog if it collides with any game object with a collider component attached to it. So, when we add more frogs later, and when they collide with each other, the frogs will get destroyed. To fix this problem, simply add a tag to the lake in the inspector and in the script check if the frog collided with the game object with the tag “lake”.&lt;/p&gt;

&lt;p&gt;We’ll add a tag and name it “lake” in the inspector as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AlzWRwP0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3nrcr6yll8soj0w7fpc3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AlzWRwP0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3nrcr6yll8soj0w7fpc3.png" alt="Image description" width="700" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s write the following code in the “KillFrog” script to make sure the frog collides only with the game object with the “lake” tag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I__-_zJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8gmeeogy7n4atmhsn8z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I__-_zJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8gmeeogy7n4atmhsn8z.png" alt="Image description" width="880" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the frog is ready to be a prefab.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a prefab
&lt;/h2&gt;

&lt;p&gt;Before creating a prefab, create a new folder inside the assets folder and name it “Prefabs”. To create a prefab, simply drag the game object (in this case, the frog) from the hierarchy into the prefabs folder. And voila – you have a frog prefab.&lt;/p&gt;

&lt;h2&gt;
  
  
  C# script: Instantiate a prefab in a random place
&lt;/h2&gt;

&lt;p&gt;Before instantiating several frogs into the scene, delete the frog currently in the scene. To do so, just right click on the frog and then delete. We don’t need it anymore as we will instantiate several frogs from the prefab we just created.&lt;/p&gt;

&lt;p&gt;We want to instantiate the frog within the bounds of the screen right. To do so, we need to determine the width and height of the screen. We will generate a random number between 0 and the width of the screen for the X position and random number between 0 and the height of the screen for the Y position.&lt;/p&gt;

&lt;p&gt;To do this, write the following code in a new script file called “Spawn”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fTa3IvQ8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lb7mnt4mf4qyj5hpd6x6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fTa3IvQ8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lb7mnt4mf4qyj5hpd6x6.png" alt="Image description" width="880" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this script to work it has to be attached to a game object. We can attach it to the main camera and drag and drop the frog prefab into the empty field.&lt;/p&gt;

&lt;p&gt;Let’s run the game and check where the frog will appear:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IwaSv1Fu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ms11xegwav3o62d7qgie.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IwaSv1Fu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ms11xegwav3o62d7qgie.gif" alt="Image description" width="600" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we can generate several more frogs.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to instantiate several sprites
&lt;/h2&gt;

&lt;p&gt;There are several ways to do this. First, we can write the code in the update function. In this case we will get a frog in every game frame. That will probably be too much – but let’s check it out.&lt;/p&gt;

&lt;p&gt;Now cut the code you wrote in the start function and paste it in the update function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NB-ylICq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwvncnn505l8zm81ufw3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NB-ylICq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwvncnn505l8zm81ufw3.gif" alt="Image description" width="600" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See what happened here? The reason for this is the default rate for a Unity game is 60 frames per second. And in our code above, we generate a frog every frame.&lt;/p&gt;

&lt;p&gt;The second way to do this is to specify a certain number of frogs you want to instantiate in the current scene. We can use afor loop for this case so cut the code and paste it in the start function cause we want it to work only one time.&lt;/p&gt;

&lt;p&gt;Check the code below and run the game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---pEUDTDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k7e3l1k6ez9dc28bxmxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---pEUDTDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k7e3l1k6ez9dc28bxmxp.png" alt="Image description" width="880" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L9RsuinC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/stpzlwbxha1c2yfkom86.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L9RsuinC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/stpzlwbxha1c2yfkom86.gif" alt="Image description" width="600" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A third way to do so is to use IEnumerator function and StartCoroutine. They are used if you want to pause a running function for a few seconds and call that function again. In this code, we wait for 0.8 seconds before instantiating a frog so every 0.8 second a frog is spawned in the scene. This code runs forever, as long as the game is running. Let’s check the code below and run the game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--guLb9mMN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cznln7gppamjo9j9lwwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--guLb9mMN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cznln7gppamjo9j9lwwa.png" alt="Image description" width="880" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f6T2yQvS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/niki8yfeu33kzs116zgw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f6T2yQvS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/niki8yfeu33kzs116zgw.gif" alt="Image description" width="600" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a Score Counter
&lt;/h2&gt;

&lt;p&gt;Now we want to count the score for when we kill the frogs and keep this number so we could display it later.&lt;/p&gt;

&lt;p&gt;First, we need a public integer variable for the score. Second, we need a player preferences variable to keep this score across the game and this one will be accessed from any script. It will be saved on the player’s device. We have to save the public integer in the player preferences variable after the player kills a frog.&lt;/p&gt;

&lt;p&gt;Let’s go back to the script attached to the frog, “KillFrog”, and write the code below. What we need to do is, after we kill the frog, we increase the score and save it in the player preferences variable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O7twOMxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nluc7rvab1988uibw7re.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O7twOMxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nluc7rvab1988uibw7re.png" alt="Image description" width="880" height="824"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For now (before displaying the score), we can log the score into the console to see if it is working.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Debug.Log("Score "+ TotalScore.ToString());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fdz6lY5c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bdbcmgoz88cr3ntbxoc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fdz6lY5c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bdbcmgoz88cr3ntbxoc.gif" alt="Image description" width="600" height="214"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s display the score in the scene.&lt;/p&gt;

&lt;p&gt;We need a text game object for the score. To add one, just right click on the canvas object in the hierarchy and select UI then Text. Name it “ScoreText”. The text is so small and in the middle of the scene. Let’s drag it to the top left of the scene, increase the font size to 50, change the text to “Score”, change the color to black, make it bold, and change the vertical overflow to “Overflow”. It should look like the image shown below.&lt;/p&gt;

&lt;p&gt;Now we need to change the score text dynamically. Let’s go back to the “Spawn” script and write the following code. We will need to drag the text object into the empty field in the inspector.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MmDQkHPG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mte6yggtjoae05z9upcj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MmDQkHPG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mte6yggtjoae05z9upcj.png" alt="Image description" width="880" height="484"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cHFliL_S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxf1glrf3r3sccwjm75x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cHFliL_S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxf1glrf3r3sccwjm75x.png" alt="Image description" width="880" height="851"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s run the game and see the score changing dynamically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NHNoKQJY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0n66q0ccclhcxxlik20.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NHNoKQJY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0n66q0ccclhcxxlik20.gif" alt="Image description" width="600" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Issue Alerts to monitor errors
&lt;/h2&gt;

&lt;p&gt;If we want to get alerted when errors occur in our Unity game, we can set up Issue Alerts in Sentry so we’ll know when our code is breaking. We’d like to monitor for errors while avoid getting spammed by tons of alerts about the same errors. With Sentry you can group errors together in a single issue and get notified about the issues you care most about. You can create conditions, for example (to name a few):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;when you want to be notified&lt;/li&gt;
&lt;li&gt;who will receive this notification from your team&lt;/li&gt;
&lt;li&gt;what error type(s) you want to get notified about&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Sentry, we can create two types of alerts: Issue Alerts for errors and Metric Alerts for performance issues as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zahpgDHC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8g75gnn30py9bcib1vo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zahpgDHC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8g75gnn30py9bcib1vo.png" alt="Image description" width="524" height="1408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s quickly define all the specific issues or metrics we can create alerts for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issues&lt;/strong&gt;: It is used for a group of errors and you can check an example of creating one below these bullet points.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Number of Errors&lt;/strong&gt;: This one is self explanatory, it is when the number of errors exceeds a certain number you specified. Users Experiencing Errors: When you want to monitor if the number of users having errors exceeded a certain number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crash Free Session Rate&lt;/strong&gt;: When you want to monitor the rate of a session without crashing. A session is when the application starts and ends by either getting closed or goes into the background. Crash Free User Rate: The number of users who haven’t experienced a crash while using the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Throughput&lt;/strong&gt;: When you want to monitor the number of transactions in a specified amount of time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transaction Duration&lt;/strong&gt;: When you want to know how long a transaction takes to complete.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apdex&lt;/strong&gt;: When you want to monitor the user satisfaction rate and that is measured through the response time of your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failure rate&lt;/strong&gt;: When you want to monitor the rate of failed transactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Largest Contentful Paint&lt;/strong&gt;: When you want to monitor the loading time of the largest content to render in the viewport.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;First Input Delay&lt;/strong&gt;: When you want to monitor the response time of when the user interacts with the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cumulative Layout Shift&lt;/strong&gt;: When you want to monitor the visual layout shift. For example, if an image is taking time to load and when it loads it shifts other items on the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Metric&lt;/strong&gt;: When you want to monitor a metric not included the list above, you can create a custom one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s create a new alert.&lt;/p&gt;

&lt;p&gt;You can set rules for Issue Alerts on the alerts page in Sentry. To create an Alert rule simply click on “Create Alert” then the “Set Conditions” button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DIirB7bT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jygft88c3av6gqb7ct3i.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DIirB7bT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jygft88c3av6gqb7ct3i.gif" alt="Image description" width="600" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll set two types of triggers which will determine the activity type we want to monitor.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Issue state change, and&lt;/li&gt;
&lt;li&gt;Frequency&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rJDA6nq0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ro66ff8hvxqb4fjsqv8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rJDA6nq0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ro66ff8hvxqb4fjsqv8f.png" alt="Image description" width="880" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I want to get an email when there is an event and it is seen more than 5 times in 1 hour. Select from the filter options. Filter is for adding “if” conditions to rule out unneeded errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5j-JOM4v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnijylbqn1uhzv5ambam.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5j-JOM4v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnijylbqn1uhzv5ambam.png" alt="Image description" width="880" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And I want to select the level of this event to be error. There are several levels for the events and they are: sample, debug, info, warning, and fatal.&lt;/p&gt;

&lt;p&gt;Next we’ll add an action for this alert. You have the option to set up &lt;a href="https://docs.sentry.io/product/integrations/notification-incidents/slack/"&gt;Slack notifications&lt;/a&gt;, send a notification to another team member, send via email, create tickets in Microsoft Teams or create a ticket in Jira.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mRXgxyTI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ts4579wukrqs1bsou0b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mRXgxyTI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ts4579wukrqs1bsou0b.png" alt="Image description" width="880" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fjGO7vMI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dh5udc7xfii8rk0gjmgg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fjGO7vMI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dh5udc7xfii8rk0gjmgg.png" alt="Image description" width="880" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, you can set an interval for this action. As I mentioned earlier, I’d like an email to be sent every hour.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cKn2b3Bz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ve5gsfpu66d54axfpcgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cKn2b3Bz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ve5gsfpu66d54axfpcgr.png" alt="Image description" width="880" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s trigger an intentional error and see if we get an alert and an email.&lt;/p&gt;

&lt;p&gt;Go back to the Unity project and remove the score text game object from the field in the Main Camera inspector in the script component. Now run the game and play it for a bit. You can see that the score is not updating and you are getting tons of errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vo-MAmX3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68eo16zf0e43t9htb8x3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vo-MAmX3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68eo16zf0e43t9htb8x3.gif" alt="Image description" width="600" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Back in Sentry, you will find 1 alert triggered, and you can check your email to find a notification sent from Sentry about this alert. The image shown below is the Alert page after getting 1 Alert triggered. You will find a graph showing the number of times this alert has been triggered over a specified date range. On the right, you will find last time this alert was triggered, the alert conditions that you specified, plus more details about this alert.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rEv9ebP9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83qjg8gjek0bfw7ohfz4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rEv9ebP9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83qjg8gjek0bfw7ohfz4.png" alt="Image description" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go fix the error by dragging the text object into the empty field in Unity, and close it out in Sentry by clicking resolve. We’ll keep our alert settings in place in case we experience this error again in the future.&lt;/p&gt;

&lt;p&gt;That’s all for now. Stay tuned for my next article where we will finalize our frog game.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unity Tutorial: Developing Your First Unity Game - Part 1</title>
      <dc:creator>Dev Rayda</dc:creator>
      <pubDate>Thu, 07 Apr 2022 12:34:57 +0000</pubDate>
      <link>https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-1-3km3</link>
      <guid>https://dev.to/devrayda/unity-tutorial-developing-your-first-unity-game-part-1-3km3</guid>
      <description>&lt;p&gt;This article was originally published on the Sentry blog &lt;a href="https://blog.sentry.io/2022/04/01/unity-tutorial-developing-your-first-unity-game-part-1/?utm_source=DevTo&amp;amp;utm_medium=referral&amp;amp;utm_campaign=rayda-unity-tutorial-blog-2"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Welcome to the second article in this Unity series. You can check out the first article, where I dive into Unity editor basics, &lt;a href="https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk"&gt;here&lt;/a&gt;. Over the next few posts we are going to develop a fully functional mini game. In this article, we are going to walk-through adding a new scene, two important components (Rigid 2D and Box Collider 2D), how to destroy a game object, prefab, and how to instantiate a prefab.&lt;/p&gt;

&lt;p&gt;The following should be installed on your computer to follow along this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unity &lt;/li&gt;
&lt;li&gt;Unity Hub &lt;/li&gt;
&lt;li&gt;Visual Studio&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this tutorial, Unity Version “2020.3.23f1” is used.&lt;/p&gt;

&lt;p&gt;At the end of this series, a 2D mini game will be created. In this game, players will try to tap on frogs, who will be appearing in random places, before they fall into our lake. When players tap on them there will be a purple smoke effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding a New Scene
&lt;/h2&gt;

&lt;p&gt;Let’s add a new scene in the project we created last time. This scene will be our new mini game. To add a new scene, simply right click in the Assets/Scenes folder &amp;gt; Create &amp;gt; Scene.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kyb6oSDR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649330916944/SYElye7sA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kyb6oSDR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649330916944/SYElye7sA.png" alt="image.png" width="880" height="993"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Name the new scene “TapGame”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---zXwfAiZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649330939190/BUi-BKo6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---zXwfAiZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649330939190/BUi-BKo6z.png" alt="image.png" width="748" height="982"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the new scene and add a background image. Follow the exact steps that were covered &lt;a href="https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk"&gt;here&lt;/a&gt; in my last article. This is how the scene should look (below). In the hierarchy, you should have an event system and a canvas with the background image as a child.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jSodK1wg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331019679/ZlOQ9EWDf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jSodK1wg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331019679/ZlOQ9EWDf.png" alt="image.png" width="880" height="701"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding the sprite
&lt;/h2&gt;

&lt;p&gt;Now we will add the frog sprite. Just drag and drop the frog in the hierarchy, and scale the frog down to 0.1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QJc4HCuy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331056717/MwZcU-r9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QJc4HCuy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331056717/MwZcU-r9y.png" alt="image.png" width="880" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we’ll add two important components to the frog sprite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Box Collider 2D
&lt;/h2&gt;

&lt;p&gt;Since we want to click on the frog, we need a Collider 2D component. Collider 2D components help in defining the physical shape of the game object for collision and trigger purposes. There are several shapes for the Collider 2D aside from the “Box”, which is a rectangle shape, and they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Circle collider 2D for round objects&lt;/li&gt;
&lt;li&gt;Polygon collider 2D for 2D complex shape&lt;/li&gt;
&lt;li&gt;Edge collider for surfaces&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The frog’s shape is closer to a rectangle so I chose the Box Collider 2D.&lt;/p&gt;

&lt;p&gt;Let’s add this component and check the inspector. Click on “Add Component” and select “Box Collider 2D”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iI9tLBlO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331137643/l05Omo4RI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iI9tLBlO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331137643/l05Omo4RI.png" alt="image.png" width="694" height="1430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s check the component’s properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vnbFSRgU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331148503/TAy5y386S.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vnbFSRgU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331148503/TAy5y386S.png" alt="image.png" width="694" height="1430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Edit Collider:&lt;/strong&gt; As the name suggests, we can edit the collider rectangle by clicking on this button. When you click on it, you will see a green rectangle around the frog as shown in the image below. You can move the lines by selecting the small squares.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S_UTV2SY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331193953/xpLJ3Ls9-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S_UTV2SY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331193953/xpLJ3Ls9-.png" alt="image.png" width="880" height="593"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Material:&lt;/strong&gt; the physical material that covers your game object that affects its physical properties, such as friction and bounce.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Is Trigger:&lt;/strong&gt;check this one if you want the Cox collider 2D to be a trigger. A trigger means that if a rigidbody gets in the trigger’s volume it will send these messages: OnTriggerEnter, OnTriggerExit, and OnTriggerStay. If it is checked, a collision with a rigidbody won’t be registered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Used By Effector:&lt;/strong&gt; check this if you have an Effector 2D component added to the game object, and you want to direct the forces according to that effector component when game objects collide with each other.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Used By Composite:&lt;/strong&gt; check this box if you have a Composite Collider 2D component added to the game object. When you check this one, some properties disappear, “Is Trigger”, “Material”, “Used By Effector”, and “Edge Radius”, as they are controlled by the composite 2D component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auto Tiling:&lt;/strong&gt; Check this if the sprite draw mode is Tiled. I will explain tiled draw mode in a later article, but if you’re curious now, you can read more about it here in Unity’s documentation. The shape of the collider will be updated automatically when the sprite’s size changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Offset:&lt;/strong&gt; when you move the collider lines, the offset values change. The values are zero when the lines are exactly on the edges of the sprite.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Size:&lt;/strong&gt; this one is self explanatory, the size of the collider box.&lt;br&gt;
Edge Radius: this is the corner radius of the collider box and controls whether you want the box edgy, or with round corner radii.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Rigidbody 2D
&lt;/h2&gt;

&lt;p&gt;Now let’s add a Rigidbody 2D component to the frog by first clicking “Add Component”. We’ll then search for Rigidbody 2D and add it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zhqZB8VT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331475077/Ux3Enj-SZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zhqZB8VT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331475077/Ux3Enj-SZ.png" alt="image.png" width="694" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DQ9c-X3x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331482790/Q92AcZCUT.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DQ9c-X3x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331482790/Q92AcZCUT.png" alt="image.png" width="694" height="1416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before doing anything else, let’s click on the play button to see what happens in our mini game so far…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F3pJKyow--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f7pyzlyxbhfo84vl79h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F3pJKyow--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f7pyzlyxbhfo84vl79h.gif" alt="Image description" width="600" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the frog just falls down and leaves the screen. This is because the frog has a rigidbody that is affected by gravity as it is under the control of Unity’s physics engine.&lt;/p&gt;

&lt;p&gt;Let’s check the Rigidbody 2D component properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JNhpF8zC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331652488/N6Wbj4VfJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JNhpF8zC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331652488/N6Wbj4VfJ.png" alt="image.png" width="700" height="956"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Depending on the Body Type, the properties of the Rigidbody 2D component change. The body type affects movement and collider interaction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Body Type: Dynamic
&lt;/h3&gt;

&lt;p&gt;The Dynamic body type is the default type. It has all the properties and is the most interactive.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Material:&lt;/strong&gt; The physical material is the same as the one I explained in Collider 2D component. If there isn’t one already set in the Collider 2D component, this is the material that will be used. If there is a physical material set in both components, the priority will be the material set in the Collider 2D component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simulated:&lt;/strong&gt; When this one is checked (and it is checked by default) the Rigidbody 2D component and any attached Collider 2D components will interact with the physics simulation. If not checked, they won’t.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Auto Mass:&lt;/strong&gt; Check it if you want to use the mass from the attached Collider 2D component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mass:&lt;/strong&gt; Define the object’s mass&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Linear Drag:&lt;/strong&gt; A coefficient that affects positional movement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Angular Drag:&lt;/strong&gt; A coefficient that affects rotational movement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gravity Scale:&lt;/strong&gt; This is self explanatory: how much do you want your object to be affected by gravity? For a lower gravity effect, pick a number less than 1. There is a simple way to make the frog fall down slower. Let’s change the gravity scale into 0.3 to have a slower speed. You can check the frog’s falling speed by running the game.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Collision Detection:&lt;/strong&gt; This will either be discrete or continuous. If Discrete is selected, game objects can pass through each other after a collision. If Continuous is selected, game objects can not pass through each other.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sleeping Mode:&lt;/strong&gt; The three modes for the game object’s sleeping: Never Sleep, Start Awake &amp;amp; Start Asleep.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interpolate:&lt;/strong&gt; This defines how the game object’s movement is interpolated. There are three options:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;None - no movement smoothing at all&lt;/li&gt;
&lt;li&gt;Interpolate - smoothed movement based on the game object’s previous frame position&lt;/li&gt;
&lt;li&gt;Extrapolate - smoothed movement based on the game object’s next frame position.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Constraints:&lt;/strong&gt; This is used to restrict the game object’s position or rotation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Body Type: Kinematic
&lt;/h3&gt;

&lt;p&gt;A game object with a kinematic body type is not affected by gravity or forces. So it is faster than a dynamic body type game object. You will need scripts to determine how this game object should move and physics queries to detect collisions. It only collides with a dynamic rigidbody.&lt;/p&gt;

&lt;p&gt;As you can see from the image below, some properties we defined above are not available for the Kinematic Rigidbody.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DvIeh_fO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331890535/8pwOOQyoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DvIeh_fO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331890535/8pwOOQyoz.png" alt="image.png" width="700" height="792"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We do see one new property, however.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use Full Kinematic Contacts:&lt;/strong&gt; If you want this kinematic rigidbody to interact with all rigidbody types, check this option, but understand it will act as an immovable game object.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Body Type: Static
&lt;/h3&gt;

&lt;p&gt;This rigidbody type does not move at all under simulation even if another game object collides with it. It only collides with dynamic rigidbody game objects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pmiuLZC2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331925459/NQCTNZbZu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pmiuLZC2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331925459/NQCTNZbZu.png" alt="image.png" width="700" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this game, we want the frog to have a dynamic Rigidbody type with a gravity scale of 0.3.&lt;/p&gt;

&lt;h2&gt;
  
  
  Destroying a Game Object
&lt;/h2&gt;

&lt;p&gt;In order to destroy a frog when a player taps on it, we’ll need to write a C# script.&lt;/p&gt;

&lt;p&gt;For organizational purposes, let’s create a new folder and name it “Scripts”. Move the “Scale” script we created in &lt;a href="https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk"&gt;my last article&lt;/a&gt; to this folder. Right click in the Assets folder &amp;gt; Create &amp;gt; Folder, as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S4jBJJgR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331954466/VHLmcEsmR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S4jBJJgR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331954466/VHLmcEsmR.png" alt="image.png" width="880" height="1045"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s create a new C# script inside the “Scripts” folder. Right click in the Scripts folder &amp;gt; Create &amp;gt; C# script, as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LlO95m4N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331966290/YB21WnLuZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LlO95m4N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331966290/YB21WnLuZ.png" alt="image.png" width="880" height="1115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll name it: KillFrog&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--we6QI8Dv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331979621/QEOPOThfV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--we6QI8Dv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331979621/QEOPOThfV.png" alt="image.png" width="754" height="932"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now open the “KillFrog” script and write the following code:&lt;/p&gt;

&lt;p&gt;Add a onMouseDown() function and inside it, Destroy(gameObject). This will destroy the game object it is attached to when a player clicks (on PC/laptop) or taps (on a tablet/mobile phone) on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YoFU5QF2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333741882/sbcQItUBB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YoFU5QF2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333741882/sbcQItUBB.png" alt="image.png" width="880" height="931"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Attach this script to the frog by simply dragging the script into the frog’s inspector, or the frog object itself, in the hierarchy.&lt;/p&gt;

&lt;p&gt;Now let’s run the game and check if it is working.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tvGYMJZL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331998194/jqs3RzG0H.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tvGYMJZL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649331998194/jqs3RzG0H.png" alt="image.png" width="880" height="931"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It disappears! Clicking on the frog destroy it, but what if we want to add an effect when the frog is destroyed?&lt;/p&gt;

&lt;p&gt;Let’s explore two new concepts for this type of effect:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Prefab&lt;/li&gt;
&lt;li&gt;Game object instantiation&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prefab
&lt;/h2&gt;

&lt;p&gt;A prefab is simply a game object template. You can configure a game object with the needed components and its properties, and then can create an instance from this prefab in the scene. The game object instance will have these components with the configured properties. When you change the components in a prefa, all the instances’ components will change as well so they will be in sync.&lt;/p&gt;

&lt;p&gt;When you want a game object to appear in the scene that was not created from the start, you need to instantiate a game object at runtime. To be able to instantiate a sprite, for example, you need a prefab. When you instantiate a game object at runtime, there will be an instance of that game object created in the scene.&lt;/p&gt;

&lt;p&gt;To create a prefab simply drag the game object from the Hierarchy into the project Assets folder (after, of course, adding all the components you need.You can edit these components and add more components anytime).&lt;/p&gt;

&lt;p&gt;We will create a frog prefab later in the series when we finish all the needed components. But for now we understand what a prefab is.&lt;/p&gt;

&lt;p&gt;Time to add an effect for when the frog is killed. Let’s visit the Unity Asset store to browse effects.&lt;/p&gt;

&lt;p&gt;Unity Asset Store&lt;br&gt;
Unity has a &lt;a href="https://assetstore.unity.com/?gclid=Cj0KCQjw0PWRBhDKARIsAPKHFGhjyVW-jLwkFmJe9FxHaox0gshl50JnWKs7LFRw0G3xJMdRyRhKCqwaAhnCEALw_wcB&amp;amp;gclsrc=aw.ds"&gt;Unity Asset Store&lt;/a&gt; which you can visit directly or through the Unity Engine by selecting Window &amp;gt; Asset Store.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--08CzUTQS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649332925847/1v5k55mHa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--08CzUTQS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649332925847/1v5k55mHa.png" alt="image.png" width="880" height="637"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is an assets store with tons of free and paid assets you can use in your games. Check their licenses before using them commercially, though.&lt;/p&gt;

&lt;p&gt;I will use the &lt;a href="https://assetstore.unity.com/packages/vfx/particles/cartoon-fx-free-109565#"&gt;Cartoon FX Free&lt;/a&gt; effect. This asset is available for free and has around 50 cartoon effects.&lt;/p&gt;

&lt;p&gt;To import this asset into your project, click on the “Add to My Assets” button in the Asset Store.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7JPu0S5k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333026884/VvOFNcxha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7JPu0S5k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333026884/VvOFNcxha.png" alt="image.png" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Accept the Terms of Service and then click Open in Unity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Um4C5Abx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333126487/3yUp1KkTz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Um4C5Abx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333126487/3yUp1KkTz.png" alt="image.png" width="880" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Package manager will open and you’ll be able to download the package.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mVFg_Lzr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333135113/a1_6w17ct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mVFg_Lzr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333135113/a1_6w17ct.png" alt="image.png" width="880" height="663"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Import this package into your project. You can leave all the items selected or feel free to select only a few items.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pRSj1qUb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333144680/ooN4Eumup.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pRSj1qUb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333144680/ooN4Eumup.png" alt="image.png" width="880" height="979"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will find a new folder titled “JMO Assets” in your assets folder, with 3 folders inside.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wiN2yWjl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333156174/J3OQj7K05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wiN2yWjl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333156174/J3OQj7K05.png" alt="image.png" width="605" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need the prefabs inside the first folder, “Cartoon FX”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VIWDXELr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333163699/u_aXZkkkN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VIWDXELr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333163699/u_aXZkkkN.png" alt="image.png" width="750" height="778"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These prefabs are for particle system effects. I will elaborate more on this in a later article. For now, we need an explosion effect for when a player kills the frog.&lt;/p&gt;

&lt;p&gt;Locate the explosion prefab inside the “Explosions” folder in the “CFX2 Prefabs” folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TS9NLKPf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333175615/628Ey5gCa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TS9NLKPf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333175615/628Ey5gCa.png" alt="image.png" width="750" height="778"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Double click on the explosion prefab to take a look. You can click on play to see it in action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ja1gK_7f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333208876/oTv7OJkrb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ja1gK_7f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333208876/oTv7OJkrb.gif" alt="ezgif.com-gif-maker.gif" width="600" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s instantiate this prefab when we destroy the frog.&lt;/p&gt;
&lt;h2&gt;
  
  
  Instantiate a prefab
&lt;/h2&gt;

&lt;p&gt;To instantiate a prefab, you only need one line of code and a reference to that prefab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xDQGvzQK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333242289/uz_e_q8s0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xDQGvzQK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333242289/uz_e_q8s0.png" alt="image.png" width="880" height="784"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s understand this line of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Instantiate(SmokeEffect, transform.position, Quaternion.identity);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XX4P7Ley--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333258624/gaHqJsKFc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XX4P7Ley--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333258624/gaHqJsKFc.png" alt="image.png" width="880" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;[SerializeField]&lt;/strong&gt; makes this a public game object where we can drag the prefab and into the field within the inspector of the game object that the script is attached to.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;transform.position:&lt;/strong&gt; this position is that of the game object the script is attached to, which is the frog in this case – which is exactly what we want.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quaternion.identity:&lt;/strong&gt; Quaternion means zero rotation so the explosion will not be rotated.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s save the script and go back to Unity to drag the explosion effect into the empty field of the script, as shown in the images below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_wSGpMeN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333297466/OVtLXs8wj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_wSGpMeN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333297466/OVtLXs8wj.png" alt="image.png" width="880" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kUDwQKsh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333312362/3Kmd7zaFW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kUDwQKsh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333312362/3Kmd7zaFW.png" alt="image.png" width="700" height="594"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to run the game and tap on the frog to see if this worked…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pds-0Ov8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfv99vtljtcyhs00jld0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pds-0Ov8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfv99vtljtcyhs00jld0.gif" alt="Image description" width="600" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Monitoring Using Sentry
&lt;/h2&gt;

&lt;p&gt;In my last article I introduced Sentry and used it to track our game’s errors and monitor our game’s performance. In this article I will focus in more on error monitoring.&lt;/p&gt;

&lt;p&gt;Let’s make an intentional error &amp;amp; track it in Sentry.&lt;/p&gt;

&lt;p&gt;I’m going to remove the explosion game object from the “Smoke Effect” reference field in the script “KillFrog” inspector as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A6FwsPdn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333411430/SKkzvLD_i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A6FwsPdn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333411430/SKkzvLD_i.png" alt="image.png" width="700" height="684"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the game, tap on the frog and see what happens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q5JhbWLn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333438569/6LFmh6SON.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q5JhbWLn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333438569/6LFmh6SON.gif" alt="ezgif.com-gif-maker copy 2.gif" width="600" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the frog is destroyed but there is no explosion effect and we get an error in the console, an Unassigned Reference Exception.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OCNHpJLz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333471967/GC4c48-d7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OCNHpJLz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333471967/GC4c48-d7.png" alt="image.png" width="880" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can open up Sentry to see all the context for this error. Since we don’t sit at our desk all day waiting for errors to occur, we can set up &lt;a href="https://docs.sentry.io/product/alerts/"&gt;alerts&lt;/a&gt; to show errors based on criteria (like how often they’re happening) and &lt;a href="https://docs.sentry.io/product/alerts/notifications/"&gt;notifications&lt;/a&gt; to our email or &lt;a href="https://docs.sentry.io/product/integrations/notification-incidents/slack/"&gt;Slack&lt;/a&gt;workspace.&lt;/p&gt;

&lt;p&gt;From the issues tab, you will find you have an unresolved issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2WroMopI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333484924/uV_-Adlnp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2WroMopI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333484924/uV_-Adlnp.png" alt="image.png" width="880" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The issue is “Unassigned Reference Exception”. Let’s open the error page and dive in.&lt;/p&gt;

&lt;p&gt;When you arrive on the error page, you will find the name of your project, the error type, then a few buttons.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Resolve:&lt;/strong&gt; closes out the issue when you resolve it&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ignore:&lt;/strong&gt; If you want to ignore this issue (perhaps we’re already aware of it, or it’s noisy and we need to edit our criteria for when we’re alerted about this particular error)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mark reviewed:&lt;/strong&gt; If you’ve already reviewed this issue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Delete (icon):&lt;/strong&gt; you can delete this issue without solving it, but of course this error will be created again if the issue happens again.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Share:&lt;/strong&gt; Get a link to share it with colleagues, or publicly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open in Discover:&lt;/strong&gt; You will need a business plan for this feature. You can start a &lt;a href="https://sentry.io/pricing/"&gt;14 day trial&lt;/a&gt; to utilize &lt;a href="https://docs.sentry.io/product/discover-queries/"&gt;Discover&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O_NQP6Im--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333504126/DWWJdJ1Ji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O_NQP6Im--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333504126/DWWJdJ1Ji.png" alt="image.png" width="880" height="125"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then you have the exception section where we can see the error type and what went wrong. For example, here, we see exactly why this error occurred and what we need to do to fix it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The error: “The variable SmokeEffect of KillFrog has not been assigned.”&lt;/li&gt;
&lt;li&gt;How to fix it: “You probably need to assign the SmokeEffect variable of the KillFrog script in the inspector.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then it gives more details on the error: The error happened at line 28 in the KillFrog.OnMouseDown function when we tried to instantiate.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GhoAoRs9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333807646/q10Il00io.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GhoAoRs9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333807646/q10Il00io.png" alt="image.png" width="880" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below that we see the breadcrumbs, which shows us what happened leading up to the error occurring.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m6cUwDKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333817792/YDu3i43cG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m6cUwDKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333817792/YDu3i43cG.png" alt="image.png" width="880" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Along the right hand side in Sentry, as shown in the image below, we are provided with additional context about this error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DhKydEy9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333825876/V2BghoRl2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DhKydEy9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1649333825876/V2BghoRl2.png" alt="image.png" width="352" height="1354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the top, we see “Ownership Rules”, which are used when you have a team so that issues can be automatically routed to the right person to resolve the issue. Next, you will notice “first seen” and “last seen” times to give you a quick understanding of how long ago, and how recently, this issue has occurred. If you want to connect Sentry to your issue tracking tool, like JIRA, you can do so here (as well as in Settings). Below that are tags related to this issue which provide even more context (what devices or operating systems are experiencing this particular error? Which release(s) is the error showing up in?). And finally, which team members are already participating/working on this issue.&lt;/p&gt;

&lt;p&gt;In summary, Sentry is providing us with a lot of context about the issue.&lt;/p&gt;

&lt;p&gt;We can fix the issue by assigning the explosion prefab in the inspector and resolving it (clearing it out) in Sentry. Again, as mentioned above, if we want to set up a specific alert for if/when this error occurs again, we can manage our &lt;a href="https://docs.sentry.io/product/alerts/alert-types/#issue-alerts"&gt;alerts&lt;/a&gt; to get notified when certain error criteria that set is met.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Thank you for reading and I hope you learned more about the Unity &amp;amp; Sentry platforms. Stay tuned for the next article where we will continue developing our exploding frog game.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unity Tutorial: What You Need to Know Before Developing Your First Unity Game</title>
      <dc:creator>Dev Rayda</dc:creator>
      <pubDate>Fri, 25 Mar 2022 08:55:31 +0000</pubDate>
      <link>https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk</link>
      <guid>https://dev.to/devrayda/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game-33mk</guid>
      <description>&lt;p&gt;This article was originally published on the Sentry blog &lt;a href="https://blog.sentry.io/2022/03/21/unity-tutorial-what-you-need-to-know-before-developing-your-first-unity-game?utm_source=DevTo&amp;amp;utm_medium=referral&amp;amp;utm_campaign=rayda-unity-tutorial-blog-1"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this article we are going to talk about Unity basics. By the end you will understand the Unity editor interface, Game Objects and Sprites, the frequently used UI elements, and a high-level overview of how to monitor your Unity games for errors and performance issues. This is written for beginners who have never used Unity before but have previous experience using a programming language.&lt;/p&gt;

&lt;p&gt;The following should be installed on your computer to follow along this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unity&lt;/li&gt;
&lt;li&gt;Unity Hub&lt;/li&gt;
&lt;li&gt;Visual Studio&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this tutorial, Unity Version “2020.3.23f1” is used.&lt;/p&gt;

&lt;p&gt;Unity is a cross-platform game engine where you can develop 2d and 3d games. When we say cross-platform, we mean it is used to build multi-platform applications (for example, Android, iOS, desktop, virtual reality, consoles). It supports more than 19 platforms and the Unity editor is supported by macOS, Windows, and Linux.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oyyWemVK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp0cthylgc1y6z8nu67y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oyyWemVK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp0cthylgc1y6z8nu67y.png" alt="Image description" width="880" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s open Unity.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction to the Unity editor interface
&lt;/h1&gt;

&lt;p&gt;Start by opening Unity Hub &amp;gt; Click on New Project &amp;gt; Select 2D &amp;gt; Click on Create Project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kphfb3LR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023834164/OIyCT_Uom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kphfb3LR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023834164/OIyCT_Uom.png" alt="image.png" width="880" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KM5-rRQq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wh1pkd65s53gtrwfcwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KM5-rRQq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wh1pkd65s53gtrwfcwa.png" alt="Image description" width="880" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After opening Unity and creating your new project, you’ll land in the editor interface (see below). The Unity Editor has several windows. You can edit the layout to whatever suits you. But before changing the layout, let’s understand a little more about each window’s capabilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SeTYjGhr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023871242/f3aTYWP10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SeTYjGhr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023871242/f3aTYWP10.png" alt="image.png" width="880" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hierarchy window
&lt;/h2&gt;

&lt;p&gt;This window is for all the objects in the scene in hierarchical order. By objects, I mean game objects which are literally anything in the scene. In the image above, the “Main Camera” is a GameObject. The GameObjects will be arranged in the same order you created them (you can re-arrange if you’d like). The order (top to bottom) does not matter all that much in most cases. But the Hierarchy allows creation of Parent-Child relationships by dragging GameObjects into each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scene Window
&lt;/h2&gt;

&lt;p&gt;A Scene is where the actual content of your game lives. The scene can be a menu scene, a level scene, a game scene, etc. You can view the scene in 2d and 3d view, even if it is a 2d project. To do so, just toggle the 2d button as shown in the image below. In this window you can select, position, and/or modify the GameObjects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KyMG58-y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023894543/hIddZQYqR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KyMG58-y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023894543/hIddZQYqR.png" alt="image.png" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OM4YSTUe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023900614/aYTq8ngSp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OM4YSTUe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023900614/aYTq8ngSp.png" alt="image.png" width="880" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Game window
&lt;/h2&gt;

&lt;p&gt;Located just to the right of the “Scene” tab, the “Game” tab opens a window of what the player will see when they play your game.&lt;/p&gt;

&lt;h2&gt;
  
  
  Game Object Inspector Window
&lt;/h2&gt;

&lt;p&gt;From this window, you can change any component of the selected GameObject. In the image shown below, the Main Camera GameObject is selected, and below is all the detailed information for the Main Camera. “Transform”, “Camera”, and “Audio Listener” are all components added to the Main Camera by default. You can add more components to a GameObject by using the “AddComponent” button. We will talk more about components later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bqHTYz4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023920348/DK-Hl6Bug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bqHTYz4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648023920348/DK-Hl6Bug.png" alt="image.png" width="562" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Window
&lt;/h2&gt;

&lt;p&gt;This is where the project folders live. There is an Assets folder and a Packages folder. The Assets folder contains everything about your game — scenes, images, fonts, C# scripts, sound files, and more. The Packages folder contains the packages which are “extensions” to the Unity Editor that can add functionality or assets that you install from the Package Manager (for example Unity UI Package, which is installed by default). You can remove the packages from the Package Manager. To open the Package Manager click on Window in the menu bar, then Package Manager.&lt;/p&gt;

&lt;h2&gt;
  
  
  Console Window
&lt;/h2&gt;

&lt;p&gt;Just right of the Project Window is the Console Window. Here you will find log messages, error messages, and warnings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing the Layout
&lt;/h2&gt;

&lt;p&gt;I’m going to change the layout to a (personally) more preferable view.&lt;/p&gt;

&lt;p&gt;There are pre-saved layouts from the Layout dropdown menu as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wrx3WR23--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024005808/qQ02JMHvP.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wrx3WR23--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024005808/qQ02JMHvP.png" alt="image.png" width="880" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can change the layout by dragging and dropping the windows wherever you desire. Here, I dragged the Game window to be below the Scene window at the center, and the Project &amp;amp; Console windows to be below the Hierarchy window on the left. Choose whichever layout you prefer.&lt;/p&gt;

&lt;h1&gt;
  
  
  Game Objects
&lt;/h1&gt;

&lt;p&gt;A GameObject is any object in your scene. It is like a container that has properties. You change properties by adding and editing its components. Unity has a lot of components ready to be used, but you can create your own as well using C# scripts.&lt;/p&gt;

&lt;p&gt;There are a few ways to create a GameObject and add it to a scene:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Right-click in the Hierarchy window, then choose any of the objects from the popup menu as shown in the image below. You can create an empty object, select a 2D object, a 3D object, effects, and so on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qnflnlPl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024022018/lQcQ__FNy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qnflnlPl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024022018/lQcQ__FNy.png" alt="image.png" width="880" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Alternatively, you can drag an object from the Assets folder and drop it in the Hierarchy window (Unity will try to create a GameObject with the appropriate components for you).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you create an empty GameObject, it is an empty container until you add components. This empty GameObject can be used as a container for the scene management script, for example (we will talk about scripts later). This GameObject will not be visible to the player since it has no component that can be rendered/displayed to the player, but the script will run in the background.&lt;/p&gt;

&lt;p&gt;Let’s create one and check the inspector.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6Mu4lhJa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024064072/52ieRyjEo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6Mu4lhJa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024064072/52ieRyjEo.png" alt="image.png" width="880" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the image above, the empty GameObject only has a Transform component. We will talk about the Transform component a little later. As you can see in the Scene window, only the Main Camera is shown. The Main Camera has some special components like Gizmos which can easily be found in the scene view.&lt;/p&gt;

&lt;p&gt;Let’s check out some other frequently used game objects.&lt;/p&gt;

&lt;h1&gt;
  
  
  Sprites
&lt;/h1&gt;

&lt;p&gt;A Sprite is a 2D graphical GameObject (basically an image). They are images that cover the GameObjects to give them a visual appearance.&lt;/p&gt;

&lt;p&gt;Let’s add a Sprite into our scene.&lt;/p&gt;

&lt;p&gt;There are two ways we can add a Sprite:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you want specific shapes, like a square or a circle, right click in the hierarchy window &amp;gt; 2D Object &amp;gt; Sprites &amp;gt; Select whatever shape you want as shown in the image below.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xQRR50BH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025786073/qe-_BFGmu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xQRR50BH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025786073/qe-_BFGmu.png" alt="image.png" width="880" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Drag an image from the assets folder into the hierarchy window. To do this, we’ll need to add images into the asset folder. For organizational purposes: Create a new folder within the assets folder for Sprites / images.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HhD6LUjb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024118528/SRoWdW5Rf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HhD6LUjb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024118528/SRoWdW5Rf.png" alt="image.png" width="880" height="683"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wKlZerAL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024166963/vAh0PPezs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wKlZerAL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024166963/vAh0PPezs.png" alt="image.png" width="526" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can drag items into the images folder, or right-click on the images folder &amp;gt; Import New Asset &amp;gt; Choose the image you want from your computer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i9rTfCYl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024182458/_BHDMCEcM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i9rTfCYl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024182458/_BHDMCEcM.png" alt="image.png" width="880" height="652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m going to add an image of a frog into my Assets &amp;gt; Images folder. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zfHKpvlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024247271/Wa1XpUFHz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zfHKpvlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024247271/Wa1XpUFHz.png" alt="image.png" width="526" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s add this Sprite into the scene by dragging it into the Hierarchy window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OvCkcLIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024257224/0yoRrN-y0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OvCkcLIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024257224/0yoRrN-y0.png" alt="image.png" width="880" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the image below, the frog image appears low quality as the outline is pixelated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AoYO7bZF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024267741/IJCJZPFP0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AoYO7bZF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024267741/IJCJZPFP0.png" alt="image.png" width="880" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To improve the quality, uncheck Low Resolution Aspect Ratios as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iBoyWl7L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024273673/-pQNPuGd0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iBoyWl7L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024273673/-pQNPuGd0.png" alt="image.png" width="880" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to scale the frog down as it is too big. To do so, select the frog, then go to the Inspector and change the Scale in the Transform Component to a smaller size (0.5, for example). Another way to do this is to select (and grab) the image by one of the blue dots around it’s edges and, while holding the shift key to maintain aspect ratio, drag it to the size you want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--agIHuAvz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024284870/rX7YzJE-H.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--agIHuAvz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024284870/rX7YzJE-H.png" alt="image.png" width="880" height="602"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Sprite Inspector
&lt;/h1&gt;

&lt;p&gt;Now let’s take a look at the Sprite’s inspector.&lt;/p&gt;

&lt;p&gt;As shown in the image, a Sprite has two main components by default:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Transform&lt;/li&gt;
&lt;li&gt;Sprite Renderer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can always add more components using the “Add Component” button at the bottom.&lt;/p&gt;

&lt;p&gt;The Transform component has the object’s position, rotation, &amp;amp; scale in X, Y, &amp;amp; Z coordinates. Since this is a 2D game object, Z will be 0. These are pretty self explanatory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jDa6GQcw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024321165/jajJqB4AF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jDa6GQcw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024321165/jajJqB4AF.png" alt="image.png" width="552" height="1332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s see how these X, Y, and Z coordinates are measured.&lt;/p&gt;

&lt;p&gt;For the “Position”, X &amp;amp; Y are measured from the center of the screen. The center of the screen grid is point (0,0).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---fVjLe2Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024336483/V47aIMKI5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---fVjLe2Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024336483/V47aIMKI5.png" alt="image.png" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The frog’s center is located at point (0,0) thus position X = 0 &amp;amp; Y = 0. This point is measured from the blue circle at the center which is called the object’s pivot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CVXIXLau--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024342856/GrH-SKUnC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CVXIXLau--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024342856/GrH-SKUnC.png" alt="image.png" width="880" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Sprite’s rotation will rotate around the pivot. Let’s change rotation values and check the frog. If we change the X value, it will rotate around the X axis.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v9RREi2z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024349920/z7iUM06tD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v9RREi2z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024349920/z7iUM06tD.png" alt="image.png" width="880" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we change the Y value, it will rotate around the Y axis.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Uby0dype--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024356888/8Z2H_tGz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Uby0dype--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024356888/8Z2H_tGz5.png" alt="image.png" width="880" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we change the Z value, it will rotate around the Z axis.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1-5cPLBf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024364991/30Fb4b1Bm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1-5cPLBf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024364991/30Fb4b1Bm.png" alt="image.png" width="880" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To open the Sprite Editor window: From the menu bar, select Window &amp;gt; Select 2D &amp;gt; Sprite Editor, then select the value from the Pivot dropdown window (center is the default).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F-Dt37sg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024372034/Yp0rBAgD1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F-Dt37sg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024372034/Yp0rBAgD1.png" alt="image.png" width="722" height="1196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s define the main properties of the sprite renderer component:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sprite:&lt;/strong&gt; You can change the image here&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EJXW8PH6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024394769/Q8LbTJ09w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EJXW8PH6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024394769/Q8LbTJ09w.png" alt="image.png" width="646" height="804"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Color:&lt;/strong&gt; Change its color.The chosen color will cover the image but keeps the outline of the frog. Let’s change the color to black as shown in the image below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9lPv-pIL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024487349/kghUiiofV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9lPv-pIL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024487349/kghUiiofV.png" alt="image.png" width="880" height="594"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flip:&lt;/strong&gt; Allows you to flip the game object vertically and horizontally by checking the X &amp;amp; Y.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Additional Settings:&lt;/strong&gt; If you use layers, you can sort the GameObject into a specific layer, as well as its order in that layer. For example, you can make a background layer that will be the background image of your game. Then the UI layer will be for the buttons and menus.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  UI Game Objects
&lt;/h1&gt;

&lt;p&gt;To add these GameObjects to the scene, we right-click in the hierarchy window &amp;gt; UI menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VesPs_P2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026015829/YBecm0Cor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VesPs_P2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026015829/YBecm0Cor.png" alt="image.png" width="880" height="652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s add the following UI GameObjects and check their inspector components.&lt;/p&gt;

&lt;p&gt;When you add a text, image or button GameObject, a Canvas and an EventSystem are automatically added to the Hierarchy. Let’s define and understand these, and then we’ll continue on with the GameObjects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8c13nXlN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026037712/B7u-8qZn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8c13nXlN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026037712/B7u-8qZn8.png" alt="image.png" width="532" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Canvas
&lt;/h2&gt;

&lt;p&gt;The Canvas is a container for all UI elements in the scene. All UI elements such as texts, images, &amp;amp; buttons should be inside a Canvas. If Unity did not find one, it will add one automatically as you saw when you added a text GameObject.&lt;/p&gt;

&lt;p&gt;As shown in the image, Canvas inspector has four components in its inspector by default:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rect Transform&lt;/li&gt;
&lt;li&gt;Canvas&lt;/li&gt;
&lt;li&gt;Canvas Scaler&lt;/li&gt;
&lt;li&gt;Graphic Raycaster&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Rect Transform
&lt;/h3&gt;

&lt;p&gt;Similar to Transform but has more properties and is mainly for UI elements. Here it is grayed out, as these values are controlled by the Canvas component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_zv4UThl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024599483/Yv74m_Yi6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_zv4UThl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024599483/Yv74m_Yi6.png" alt="image.png" width="530" height="902"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Canvas
&lt;/h3&gt;

&lt;p&gt;Canvas is a component that controls how a group of UI elements will be rendered. All UI elements must be children of a Canvas. It is possible to have more than one canvas in a scene.&lt;/p&gt;

&lt;p&gt;When we look at our frog in the game view and scene view, you’ll notice the text is very small in the game view and the Canvas is shifted in the scene view.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--upbEa-s1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024640238/SipI_CE9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--upbEa-s1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024640238/SipI_CE9v.png" alt="image.png" width="880" height="837"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To adjust, we can change the Render mode to “Screen Space - Camera” and drag and drop the “Main Camera” from the Hierarchy into the Render Camera component as shown in the two images below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---i3X8Z8z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024663457/tZ_eLVikl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---i3X8Z8z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024663457/tZ_eLVikl.png" alt="image.png" width="880" height="812"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the Canvas will be centered in the main camera view as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dALGNBBi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024676004/uK8J-Nckc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dALGNBBi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024676004/uK8J-Nckc.png" alt="image.png" width="880" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Canvas Scaler
&lt;/h3&gt;

&lt;p&gt;This component lets you choose how the UI elements scale when the screen size changes from device to device. You will normally want it to scale with screen size and that is what we will do. Change the UI Scale mode to “scale with screen size” as shown:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MVwc3_Mm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024698731/qjxTG7LdV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MVwc3_Mm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024698731/qjxTG7LdV.png" alt="image.png" width="638" height="602"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We also need to choose a reference resolution. This is self explanatory. I normally choose the size of the background image so the image won’t be crushed. We will change this later after we add a background image.&lt;/p&gt;

&lt;h3&gt;
  
  
  Graphic Rayaster
&lt;/h3&gt;

&lt;p&gt;Do you ever wonder how the graphics are being detected?&lt;/p&gt;

&lt;p&gt;It is the raycaster that sends rays and looks to see if any graphics have been hit or not. (“hit by that ray”)&lt;/p&gt;

&lt;p&gt;From this component you can determine whether to ignore reversed graphics (backfacing graphics) or not, and decide on the blocking objects and masks to that ray.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4_7YpKji--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024721665/Ib1WWIMQf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4_7YpKji--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024721665/Ib1WWIMQf.png" alt="image.png" width="720" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Event System
&lt;/h2&gt;

&lt;p&gt;The Event System is for events. It captures input events from input devices (for example a mouse, keyboard, or touch on mobile devices). If there is no Event System, you will not be able to have any input events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text, Image, Button objects
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Text
&lt;/h3&gt;

&lt;p&gt;Now let’s go to the text GameObject. Locate and select the text, then drag it to where you want it on the screen (let’s move it to the top left corner). We can increase the text font size (to 30 for example) to make it more visible. It will appear the text has disappeared, but we can correc this by changing the vertical overflow in the inspector from “Truncate” to “Overflow”, as shown below. We will probably change the text color later, after we add a background image. You can change the size of the text GameObject as well by dragging the text by one of it’s corners so it will hold more text without the need to overflow. This will be needed after we make a final UI design as this text may have a background frame.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gKUNSyaT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024748103/7XRtSNzvl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gKUNSyaT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024748103/7XRtSNzvl.png" alt="image.png" width="880" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Image
&lt;/h3&gt;

&lt;p&gt;Let’s give our game (and frog) a background image. We can import a background image into the assets/images folder. I added the image GameObject into the scene and named it “BackgroundImage”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ryDh4ZuI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024762241/znIhoUMRf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ryDh4ZuI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024762241/znIhoUMRf.png" alt="image.png" width="524" height="1334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Image inspector, drag and drop the imported image into the “Source Image” property in the “Image” component.&lt;/p&gt;

&lt;p&gt;If the image looks too small, navigate to the image component and click “Set Native” to make the image its original size. But now it’s too big. Make sure position X &amp;amp; Y are both set to zero so that the image is centered.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BVDFRIzl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024774500/WFh6zxRp5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BVDFRIzl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024774500/WFh6zxRp5.png" alt="image.png" width="880" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is ok that the image is too big, the reason for this is that the canvas is set to a lower resolution. Remember earlier when I mentioned that we’d change the reference resolution to the size of the background image? Let’s go to the canvas GameObject and set the reference resolution to the size of the image.&lt;/p&gt;

&lt;p&gt;My image is 1920 x 1351 px. Now the image’s size looks good, but because it is not the same ratio as the screen, we will have to change the anchors and the image position.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6bSOss8Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024796878/qfoVuyH2F.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6bSOss8Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024796878/qfoVuyH2F.png" alt="image.png" width="880" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we want to change the image position and anchors, we can navigate to the “Rect Transform” component for our background image in the image inspector. Select “center-middle” from the anchor presets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8JOTz9j8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024815778/UC_Kt41PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8JOTz9j8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024815778/UC_Kt41PM.png" alt="image.png" width="880" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hold “Alt/Option” and select the bottom-center position for the image and anchors position to adjust. As you can see, the anchors changed their location to “bottom-center” and the image did as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oU14fkyr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024825187/SbrjwTCrE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oU14fkyr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024825187/SbrjwTCrE.png" alt="image.png" width="880" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since we added text GameObject before the background image, we’ll need to change the order to bring the text to the front. You can move objects forward or backward by moving them up (or down) in the Hierarchy window. Lower items will be more forward, and higher items more towards the back.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m52bHB_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024898638/e-jZ7Pfy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m52bHB_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024898638/e-jZ7Pfy3.png" alt="image.png" width="458" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to revisit our text object and change its size as it depends on the reference resolution of the canvas. As you can see a few images above, the text is relatively small.&lt;/p&gt;

&lt;p&gt;I changed the font size to 60 and edited it to say “Make the frog smaller”, changed the text color to black, and made the text object wider by dragging in the scene viewer. You may have noticed the text object disappears (if you happened to move it over top of the frog) as the frog is a Sprite, not an image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3PHVgSax--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024907781/xjVFQ5NsF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3PHVgSax--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648024907781/xjVFQ5NsF.png" alt="image.png" width="880" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Button
&lt;/h3&gt;

&lt;p&gt;To insert a button, right click in the Scene Hierarchy and go to Create → UI → Button. The button is accompanied with a text GameObject.&lt;/p&gt;

&lt;p&gt;We can change the position, color, and size of the text &amp;amp; the button,&lt;/p&gt;

&lt;p&gt;I edited the text game object of the button, changed the text to “Scale”, changed the color to black, and changed the font size to 40. Now we have a button that does not do anything until we add a C# script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--upOoEzm0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026263126/74rueAGJ0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--upOoEzm0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026263126/74rueAGJ0.png" alt="image.png" width="880" height="623"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction to C# Scripts
&lt;/h1&gt;

&lt;p&gt;If you’re not familiar with C#, you can get familiar with it over at &lt;a href="https://www.w3schools.com/cs/cs_intro.php"&gt;W3Schools&lt;/a&gt; or &lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/"&gt;Microsoft&lt;/a&gt;. It is the programming language used in Unity scripts.&lt;/p&gt;

&lt;p&gt;Let’s add a small C# script to our button GameObject so that when we click the button, the frog scales down. We’ll add a script component to the button by clicking on “Add Component” in the button’s inspector and name the script “Scale”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S9mLqptf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026326523/62WFNh7-p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S9mLqptf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026326523/62WFNh7-p.png" alt="image.png" width="880" height="736"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unity defaults to Visual Studio for editing, but you can select any editor you prefer from the “External Tools” panel in preferences. After double clicking on the “Scale” script we’re taken to our editor with some initial content like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gHVczOFu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025017260/PqpvUBRRW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gHVczOFu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025017260/PqpvUBRRW.png" alt="image.png" width="880" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every script made in Unity contains two functions, “Start()” and “Update()”, inside a public class with the name of the C# file you just created.&lt;/p&gt;

&lt;p&gt;When you run the game, the “Start()” function runs one time at the beginning of the game, while the “Update()” function is called once per frame. We don’t have to use these functions in every script, so we can either delete them or leave them empty.&lt;/p&gt;

&lt;p&gt;To scale down the frog when we click on the Scale button, we will make a new function, public void ScaleDown(){}, so we can call this function when we click on the Scale button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---vOKfo3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025028249/gfFf3Qmoj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---vOKfo3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025028249/gfFf3Qmoj.png" alt="image.png" width="880" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Save the script file and return to Unity to call the function and run the game. Select the button GameObject from the Hierarchy. You will find the OnClick() list in the button component in the inspector as shown in the image below. Click “+” and add the function we just created in the script. Since the script is attached to the button itself, drag and drop the button GameObject from Hierarchy to the empty GameObject area and select the “ScaleDown()” function from the drop down menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FkDojtc8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025041671/yORXb_1kV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FkDojtc8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025041671/yORXb_1kV.png" alt="image.png" width="880" height="708"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to run our game. Click the play button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jReqoaMS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025046844/U5M9u1KyK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jReqoaMS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025046844/U5M9u1KyK.png" alt="image.png" width="880" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we run the game, any changes made while in game mode cannot be saved, and when you exit game mode, everything returns to the state it was in prior to running (keep this in mind).&lt;/p&gt;

&lt;p&gt;Now let’s click on the “Scale” button and see what happens to the frog.&lt;/p&gt;

&lt;p&gt;(Before clicking on the scale button)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MBDj_jR_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025057732/DUHsPlwVU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MBDj_jR_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025057732/DUHsPlwVU.png" alt="image.png" width="880" height="834"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(After clicking on the scale button)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nC50fCfI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025064339/m_ZBDhORV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nC50fCfI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025064339/m_ZBDhORV.png" alt="image.png" width="880" height="834"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the frog is smaller — and if you check the inspector, the scale values are now 0.2. Once you stop the game, the values will return to their originals.&lt;/p&gt;

&lt;p&gt;If you made it this far — congratulations. You have made a functioning micro game!&lt;/p&gt;

&lt;h1&gt;
  
  
  Monitoring our games for errors &amp;amp; performance issues
&lt;/h1&gt;

&lt;p&gt;Whenever we develop a game so popular that it’s played by thousands of gamers, we’ll want to make sure we’re monitoring for errors and performance issues our users may experience so we can quickly resolve them. A tool like Sentry can help us with this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing Sentry
&lt;/h2&gt;

&lt;p&gt;Getting started is easy. Signup, and select “Unity” as the platform you’d like to setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DZ-EZFev--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025098070/3cbVHET8T.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DZ-EZFev--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025098070/3cbVHET8T.png" alt="image.png" width="880" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new project in Sentry and give it a name. You can associate projects with certain teams, which is useful for large organizations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dlHXNn_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025105796/_QNY3viEH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dlHXNn_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025105796/_QNY3viEH.png" alt="image.png" width="880" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once your project is created, you will find the steps to install the package, configure your DSN, and call the Unity SDK.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---a4WSdlR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025128021/Sffbw_YZX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---a4WSdlR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025128021/Sffbw_YZX.png" alt="image.png" width="880" height="588"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can open the package manager in Unity by clicking Window &amp;gt; Package Manager.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nfh0whw---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026444025/cBiGR6Ewd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nfh0whw---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026444025/cBiGR6Ewd.png" alt="image.png" width="880" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the ”+” sign and then “Add package from git URL…“.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5-0kQOCp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026527106/fZqZn0pu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5-0kQOCp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648026527106/fZqZn0pu0.png" alt="image.png" width="880" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste this URL into the input field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/getsentry/unity.git#0.10.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can get the latest URL from the “Install” section in Sentry’s docs (&lt;a href="https://docs.sentry.io/platforms/unity/"&gt;https://docs.sentry.io/platforms/unity/&lt;/a&gt;). This will install the package.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_NpFBqky--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025210006/y_dPPuTft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_NpFBqky--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025210006/y_dPPuTft.png" alt="image.png" width="880" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ll need to add our DSN by clicking on Tools &amp;gt; Sentry.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0XgKZf6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025216176/SCoP5mjpe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0XgKZf6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025216176/SCoP5mjpe.png" alt="image.png" width="880" height="879"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To find the DSN to your project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you are signed in, the Unity Sentry documentation will have the DSN to your project here &lt;a href="https://docs.sentry.io/platforms/unity"&gt;https://docs.sentry.io/platforms/unity&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N0SAIIsw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025229925/h88eNlfjK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N0SAIIsw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025229925/h88eNlfjK.png" alt="image.png" width="880" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can get the DSN for your project within Sentry’s platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go to your Projects page &amp;gt; Click on your current project &amp;gt; Settings &amp;gt; Client Keys (DSN).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6tFfYCex--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025236708/IkOTIWiTq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6tFfYCex--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025236708/IkOTIWiTq.png" alt="image.png" width="868" height="1638"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tracking errors
&lt;/h2&gt;

&lt;p&gt;To track an error in Sentry, we need to trigger an intentional one. Let’s make a spelling mistake in our frog name and check if Unity will find the frog GameObject.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MtJyJsSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025250802/4qEfAiTI0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MtJyJsSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025250802/4qEfAiTI0.png" alt="image.png" width="880" height="750"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As seen below, we triggered a Null exception error as there is no GameObject called “Frog”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HYN8_HoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025256761/8IzfD6KDO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HYN8_HoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025256761/8IzfD6KDO.png" alt="image.png" width="880" height="655"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s run the game one more time and see how Sentry tracked the error.&lt;/p&gt;

&lt;p&gt;We have a new, unhandled issue to resolve. Once we handle this exception, we can click “Resolve”. (I’ll write more about what else we can do to monitor Unity errors in Sentry in a future post).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LPGX286---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025270392/RDBE_VTL5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LPGX286---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025270392/RDBE_VTL5.png" alt="image.png" width="880" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bMr1C-wq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025286718/cwIOcgOTP.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bMr1C-wq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025286718/cwIOcgOTP.png" alt="image.png" width="880" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring performance
&lt;/h2&gt;

&lt;p&gt;A laggy game is a sure way to make someone stop playing. In addition to catching errors, it’s also important to monitor slowdowns or crashes in our game. We can get started by clicking “Performance” within Sentry.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wh5_X1mp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025318372/S2IfZTUKl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wh5_X1mp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025318372/S2IfZTUKl.png" alt="image.png" width="880" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;“Start setup” and then select the Unity SDK from the list of supported SDKs.&lt;/p&gt;

&lt;p&gt;Back in the Unity editor, navigate to Tools &amp;gt; Sentry &amp;gt; then change the “Traces Sample Rate” to a value between 0 and 1, as shown in the image below. Inputting “1” will send 100% of transactions to Sentry.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--36G2e0V0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025346916/_0mAMQWui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--36G2e0V0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025346916/_0mAMQWui.png" alt="image.png" width="880" height="883"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can open our “Scale” C# script to capture transactions for Sentry to monitor our project’s performance. We set this up by adding the code below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aggA8Lvf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025355382/DPGCmyyjL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aggA8Lvf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025355382/DPGCmyyjL.png" alt="image.png" width="880" height="714"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we can run the game and check the performance page in Sentry. You can toggle between projects, environments, and the time duration for the transactions you’re monitoring.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UMK3y_SE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025364750/5n_h1EH8A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UMK3y_SE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025364750/5n_h1EH8A.png" alt="image.png" width="880" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can look at all transactions, or filter to only look at web vitals, frontend, backend, and/or mobile transactions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rOUqwF5Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025381876/e0vaw_i2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rOUqwF5Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1648025381876/e0vaw_i2l.png" alt="image.png" width="880" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, here, the All Transactions tab is open where we can see a handful of performance metrics (more details&lt;br&gt;
&lt;a href="https://docs.sentry.io/product/performance/metrics/"&gt;here&lt;/a&gt; including User Misery, which is the number of users who experience a load time 4x the company response time threshold of 300ms).&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Thank you for reading and I hope you have a basic understanding of the Unity Platform as well as Sentry’s application monitoring platform. Stay tuned for more Unity articles as we build on our foundational knowledge.&lt;/p&gt;

</description>
      <category>unity3d</category>
      <category>gamedev</category>
    </item>
  </channel>
</rss>
