<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ryan Sweigart on Medium]]></title>
        <description><![CDATA[Stories by Ryan Sweigart on Medium]]></description>
        <link>https://medium.com/@lordkakabel?source=rss-d2f7e0b43afe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aZjwctfs-ggcZIJzDh600A.jpeg</url>
            <title>Stories by Ryan Sweigart on Medium</title>
            <link>https://medium.com/@lordkakabel?source=rss-d2f7e0b43afe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 15:38:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lordkakabel/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AR in Unity with Vuforia]]></title>
            <link>https://lordkakabel.medium.com/ar-in-unity-with-vuforia-dcc7f446702f?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcc7f446702f</guid>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[ar]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[vuforia]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Tue, 21 Sep 2021 01:35:16 GMT</pubDate>
            <atom:updated>2021-09-21T03:15:43.548Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Install Vuforia in Unity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*J6G4Mv1Cd5R0XMQMN0zP_w.gif" /></figure><p>It’s easy to add AR (augmented reality) to our Unity projects! We’ll begin by downloading the <em>Vuforia Engine</em> Unity package and dropping it into our project (<a href="https://developer.vuforia.com/downloads/sdk">https://developer.vuforia.com/downloads/sdk</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*XWH-R6G3QHCWnal53JWSzA.png" /></figure><p>Next we’ll create a Vuforia Developer account (it’s free!), then go to the License Manager and create a new license (<a href="https://developer.vuforia.com/vui/develop/licenses">https://developer.vuforia.com/vui/develop/licenses</a>). I called mine “ARFun”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*ASiIW2LFcVlxNaH9o47JfQ.png" /></figure><p>When we click on the license we’ll be given our <em>License Key</em>. We’ll need this long string of text in just a moment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*X4U_ODyuTbtd4Gs7uRkqZQ.png" /></figure><p>Back in the Unity Hierarchy, we’ll create a new Vuforia <em>AR Camera</em>. We can disable any other cameras in the scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*2sayDKjfnaiKg2oF_8ToKg.png" /></figure><p>In the AR Camera’s <em>Vuforia Behaviour</em> component, we’ll click <em>Open Vuforia Engine configuration</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*YyuWcVNtOJ_xgl3P8NiR2g.png" /></figure><p>The <em>Vuforia Configuration</em> window will open in the Inspector. We can paste our <em>License Key</em> here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*JeafCxFcWhAe1wPl6K0VsA.png" /></figure><p>Back in our Hierarchy, we’ll create a new <em>Image Target</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*3HLyTMERLKbNHdqFpNMHNw.png" /></figure><p>In the image target’s <em>Image Target Behaviour</em> component, we’ll change <em>Type</em> to <em>From Image</em>, give our image a name, and drag our image into the <em>Image</em> box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*9-0lx41yGTwoY1idb1o-Zw.png" /></figure><p>In the Hierarchy, we can attach game objects as children under the image target. In my case, I attached an animated skeleton to the image target. When the AR camera recognizes the image in the real world, it will render the attached children in relation to the real-world image!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*Auj-shVecqrINe4JCNSkHg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcc7f446702f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coroutines in Unity]]></title>
            <link>https://lordkakabel.medium.com/coroutines-in-unity-ab056874bff?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab056874bff</guid>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Fri, 17 Sep 2021 01:10:40 GMT</pubDate>
            <atom:updated>2021-09-18T02:21:00.312Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Change object’s color randomly every every two seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*BxMzMLseF_xJ4yjwopcw8Q.gif" /></figure><p>A <em>coroutine</em> will allow us to execute a process while other processes are being run. <em>Coroutines</em> are also useful when we want to delay a process. In our example, we’ll do both: Change color while the shapes are spinning, waiting 2 seconds between each change.</p><p>We’ll begin by setting our wait time (2 seconds) and caching references for the object’s <em>MeshRenderer</em> and a <em>WaitForSeconds</em> class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*Z2pWFYi3NQQEJXcs9J93QQ.png" /></figure><p>In the <em>Start</em> method, we’ll get the <em>MeshRenderer</em> component of our object and define the <em>WaitForSeconds</em> class. Then we’ll call the <em>ChangeColorRoutine</em> coroutine (More on that in a bit).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*t3yO667TdaPA5u96G84AIA.png" /></figure><p>Even though we’ve called the coroutine, our <em>Update</em> method will continue to run, causing our object to rotate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*0F6jn6866ulq0SOYf2SfkQ.png" /></figure><p>While <em>Update</em> is rotating our object, the <em>ChangeColorRoutine</em> coroutine will wait two seconds, then assign a random color to our <em>MeshRenderer</em>. Since our <em>while</em> statement is always <em>true</em>, the script will continuously wait 2 seconds then change the color!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*CLZt9TQGDWo5rO_COM1oJw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab056874bff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scriptable Objects in Unity]]></title>
            <link>https://lordkakabel.medium.com/scriptable-objects-in-unity-6ccdc218c81b?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ccdc218c81b</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[scriptableobject]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Thu, 16 Sep 2021 00:57:11 GMT</pubDate>
            <atom:updated>2021-09-16T15:30:03.180Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Use scriptable objects to fill-out a game object template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*XJPXNhEettwsKAVNw4yElA.gif" /></figure><p>We’ve been tasked with creating an interactive for visitors to a zoo. When the user clicks on an area of the map, we reveal a card with animals and facts that apply to that area.</p><p>Imagine if we had 50 exhibits. Creating a page for each one would take a lot work. Luckily, we can create one template and use scriptable objects to populate it!</p><p>Our <em>scriptable object</em> definition is really simple: Three strings to hold the text info and a sprite to hold a picture. All of our <em>scriptable objects</em> will contain these fields. The very first line, starting with <em>[CreateAssetMenu…</em> will allow us to use Unity’s editor to create <em>scriptable objects</em> using this template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*GKuCIN5KKSL68wFQAx5xjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*4byDOHqGo95gEf9jypgq_Q.png" /><figcaption>There’s our Card item in the Asset Menu!</figcaption></figure><p>We’ll create a new Card and name it <em>BearDen</em>. Then we simply fill-in the fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*BZ1c8GZCt-urmCcv6_mFkQ.png" /></figure><p>Here’s our card panel template. The <em>Title Text</em>, <em>Info Text</em>, <em>Animals Text</em>, and <em>Animal Image</em> objects will be filled-in by our <em>scriptable object</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32dz0BG_Ui9B7CZpHsdf7A.png" /></figure><p>Here is our exhibit button script. When the button is pressed, the <em>OnPress</em> method will be called, passing our scriptable object to the <em>UIManager</em>’s <em>DisplayCard </em>method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*DIiDrpyMHf7wObRYWAW-wQ.png" /></figure><p>Here is our Bear Den button. We can see the <em>ExhibitButton.OnPress</em> method is connected to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*_HCCB6p3hY5qGh3IFIARQQ.png" /></figure><p>Here is the <em>UIManager</em>’s <em>DisplayCard </em>method. It turns off the map panel, enables the card panel, and calls the card panel’s <em>PopulateCard</em> method, passing-in our scriptable object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*A-4q7XkpHDH9LrTwD-gj-A.png" /></figure><p>The final piece of our solution is the card panel’s <em>PopulateCard</em> method. It takes-in the scriptable object, and assigns each of the fields to its child objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*OgH51ukOZEmYXlR_HmjhaQ.png" /></figure><p>And here is our finished Bear Den card!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*wKebnMJHglQJfHqNMsqYhw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ccdc218c81b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Save a Binary File to AWS]]></title>
            <link>https://aws.plainenglish.io/saving-a-file-to-aws-a4b0f042c3d1?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4b0f042c3d1</guid>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Sun, 12 Sep 2021 20:20:44 GMT</pubDate>
            <atom:updated>2021-09-12T21:22:52.253Z</atom:updated>
            <content:encoded><![CDATA[<h4>Saving a binary file to Amazon Web Services for later retrieval (Part 2)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_UH4u9qYzVVzoA_R.jpeg" /></figure><p>Continuing from our previous article (<a href="https://lordkakabel.medium.com/saving-a-file-to-aws-26adf62e79ef">https://lordkakabel.medium.com/saving-a-file-to-aws-26adf62e79ef</a>), we’ll now load the file we saved to <em>Amazon Web Services (AWS)</em>. We’ll do this by calling our <em>GetObjectList</em> method. This method takes-in the user-inputted case number and an <em>Action</em> that will trigger (if supplied).</p><p>We’ll take the user’s case number and validate it to create a proper file name. Then we’ll create a request for a list of objects in our AWS bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*GIbzeE0B3yyKPPxGc_TURA.png" /></figure><p>Next we’ll cycle through the list of objects. If we get an exception, we’ll report it and won’t be able to load the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*kT0vBPGNNlGOMVMsOiJLOw.png" /></figure><p>If we don’t get an exception, we’ll look to see if any of the objects in the list match our case file name. If not, we’ll report that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*mZVnQPLLXOW1FMMs6pJRRQ.png" /></figure><p>If a match was found, we’ll get the object. Again, if an exception occurs, we’ll report it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*xMphHp9mDgUv587ltaAbsA.png" /></figure><p>Now that we have the object, we’ll prepare an array of bytes to hold the data. Then we’ll use a <em>StreamReader</em> read the response data, then access the <em>MemoryStream</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*B-6CXnTns5Y3l0uS-T7iLg.png" /></figure><p>Now we’ll create another byte array called <em>buffer</em> that is big enough to hold all the data in our file (512 bytes is plenty for my project). We’ll then read through the file, writing the file contents to our memory stream. Then we’ll put the memory stream into our array of bytes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*8kboPLp2BbAhYRVyDUxVvQ.png" /></figure><p>We’ll take our array of bytes and assign it to a new memory stream. We’ll create a new <em>BinaryFormatter</em>. We’ll use that binary formatter to <em>Deserialize</em> the memory stream and, in my project, store it as a <em>Case</em> object. We’ll tell the <em>UIManager</em> that this new object is active one we’d like to work with. Finally, if an <em>Action</em> was passed-in when this method was called, we’ll trigger it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*hWgyXvxnzsGmWwI1hnIB1g.png" /></figure><p>Our case number file was found and loaded!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*kzTp5dTnckBvRIb3br_phg.png" /></figure><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4b0f042c3d1" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/saving-a-file-to-aws-a4b0f042c3d1">How to Save a Binary File to AWS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Save a Binary File to AWS]]></title>
            <link>https://aws.plainenglish.io/saving-a-file-to-aws-26adf62e79ef?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/26adf62e79ef</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Sat, 11 Sep 2021 14:19:19 GMT</pubDate>
            <atom:updated>2021-09-12T21:22:50.104Z</atom:updated>
            <content:encoded><![CDATA[<h4>Saving a binary file to Amazon Web Services for later retrieval (Part 1)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*cgY86lk5Y8H6hOUkXa2G0w.jpeg" /></figure><p>To use <em>Amazon Web Services (AWS)</em>, we’ll need to prepare a few things: Our region, credentials, and client. We’ll use the following variable to hold these items:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*zAprrz0IELgFEDT5EA8X0A.png" /></figure><p>We’ll also need a bunch of using statements to access the various AWS libraries. Here are the ones required by my project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*PL2p0aQimFjHnqdc1C83TQ.png" /></figure><p>In our <em>Awake </em>method, initialize our game object and configure our <em>HTTP client</em>. Our credentials require our <em>AWS Identity Pool ID</em>, a string which is found in our AWS account portal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*0TWRtLpr__Ljm7bq694FLg.png" /></figure><p>With all the set-up out of the way, we can now make the upload method. We’ll need to pass-in the <em>path</em> where the file is found on the user’s device and the file name (see my previous article <a href="https://medium.com/nerd-for-tech/saving-an-object-in-unity-16766e2e3ca">https://medium.com/nerd-for-tech/saving-an-object-in-unity-16766e2e3ca</a>). We’ll open a <em>FileStream</em> with our path and give it read/write access. Then we’ll create a <em>PostObjectRequest</em>, passing in our bucket name (which we have created in our AWS account portal) and file name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*DdwtU79-CxzpQIBnuPsmfQ.png" /></figure><p>Now we’ll attempt to actually post the object by using <em>PostObjectAsync</em>. The server’s response to our <em>request</em> will be stored in <em>responseObj</em>. If the request does <em>not</em> encounter an exception (i.e., it was successful), we can move on. In the case of my project, that means reloading the scene so we can make a new case or search for ones already created. If an exception occurs, our file won’t be save and we’ll output the exception.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*E8n7Kv6k56H7yS7YLaJAZQ.png" /></figure><p>If all went according to plan, we’ll e able to see our saved files in our AWS portal!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*Nwx3nLzZTUSWTa4gw-z0ig.png" /></figure><p>In our next article, we’ll query AWS and try to retrieve the files that have been created and saved!</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26adf62e79ef" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/saving-a-file-to-aws-26adf62e79ef">How to Save a Binary File to AWS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Saving an Object in Unity]]></title>
            <link>https://lordkakabel.medium.com/saving-an-object-in-unity-16766e2e3ca?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/16766e2e3ca</guid>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[data-serialization]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Thu, 09 Sep 2021 23:51:56 GMT</pubDate>
            <atom:updated>2021-09-11T03:53:03.365Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Save a object to the user’s system for later use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*x12dPm4cdD2q1A_m1hlNvg.png" /><figcaption>An object stored as a .dat file. Not exactly user-friendly…</figcaption></figure><p>The object we’d like to save is a case file. It is made up of a few strings and a photo converted into an array of bytes. (See <a href="https://medium.com/nerd-for-tech/encoding-decoding-a-picture-in-unity-82af70b36853">https://medium.com/nerd-for-tech/encoding-decoding-a-picture-in-unity-82af70b36853</a> to learn how to convert a photo to bytes.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*lYv1yQNpNtj8_UHhKLbBJw.png" /></figure><p>When the user hits the submit button, we’ll save the info they’ve inputted. First we’ll create a new instance of a <em>Case</em> and copy the user’s input to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*gwK_tMRIujAVls_Ri3FGvw.png" /></figure><p>Then we’ll save the case as a file by opening a new <em>BinaryFormatter</em>. We’ll assign the file name and the path where the file will be stored, then append it all with the <em>.dat</em> file extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*ki-tBOjdhFuJ4LDKRbsM1w.png" /></figure><p>Next we’ll open a <em>FileStream</em> to create the file on the path. Then we’ll serialize the object and save it. Finally, we’ll close the <em>FileStream</em> and log the filepath.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*uOuQDkRM5_9o6m4p8yioBQ.png" /></figure><p>If we follow the path, we can see our file successfully saved!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*znmZdfqEAuHvMSn8aIahbQ.png" /></figure><p>In the next article, we’ll learn how to upload this file to Amazon Web Services (AWS) so the data can be accessed from almost anywhere!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16766e2e3ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Google Maps API with Unity]]></title>
            <link>https://lordkakabel.medium.com/integrating-google-maps-api-with-unity-bcb1b95d7fcc?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcb1b95d7fcc</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[google-map-api]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Thu, 09 Sep 2021 01:42:07 GMT</pubDate>
            <atom:updated>2021-09-09T03:43:07.951Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Get a picture of a map of the user’s location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*yFUy4c2JXijvbQ_-" /><figcaption>The “mighty” Susquehanna River, Harrisburg, PA</figcaption></figure><p>To display a map, we first have to get the user’s location from their device. We’ll need to use an <em>IEnumerator</em> method to do so; I’ll use the <em>Start</em> method in this case.</p><p>First we’ll make sure the user has allowed our app to access their location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*pV7M49RRRHKmKnR0SZ4RTA.png" /></figure><p>If we do have permission, we’ll tell the system to start the process. We’ll give the system 20 seconds to get a response before we give-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*Ew5RcsfzLxcOPURCreMF9A.png" /></figure><p>If the system can’t get the location, we’ll report that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*0M2AIqgLuB2XGtelzwwFlw.png" /></figure><p>If we do get the location, we’ll save the latitude and longitude.</p><p>Regardless of the result, we’ll have to stop the process we started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*YnIktjaSkY1DDJoSICOFWg.png" /></figure><p>Now that we have the location, we’ll call another <em>IEnumerator</em>. We’ll begin by assembling a URL string with all the data we need: the coordinates (the location point will in the center of the map), the zoom (how focused into the location we the result to be), the image size we want, and our Google-assigned Map APIKey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*AvKjtyAyYrayjVL0j4MzcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*b9S0xhlWTPpdGxQTcZ46Ow.png" /></figure><p>Then we’ll use a <em>using</em> statement to make a <em>UnityWebRequest</em> that will store the result of the URL as a <em>Texture</em>. (The <em>using</em> statement will clean-up after itself when finished.) We’ll then send the request. If we get an error, we’ll report it. Otherwise, everything worked and we’ll apply our texture to our image, displaying the map for our user!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*KVed0ZpvSyqWI8v2nm-xzA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcb1b95d7fcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encoding/Decoding a Picture in Unity]]></title>
            <link>https://lordkakabel.medium.com/encoding-decoding-a-picture-in-unity-82af70b36853?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/82af70b36853</guid>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Tue, 07 Sep 2021 21:29:40 GMT</pubDate>
            <atom:updated>2021-09-09T03:46:04.715Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Break a picture into an array of bytes and reassemble it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*sBM6b5kh8UORBhXdnVw6jg.png" /></figure><p>In yesterday’s article (<a href="https://lordkakabel.medium.com/taking-a-photo-in-unity-e6e3f5328da6">https://lordkakabel.medium.com/taking-a-photo-in-unity-e6e3f5328da6</a>), we allowed the user to take a picture with their device and we stored the path to the photo within the device. Today, we’ll use that path, break the photo into a array of bytes, and reassemble it back to a photo that we can display within our app.</p><p>First, we’ll prepare an array of bytes. If we have a path to the user’s photo, we’ll store it as a <em>Texture2D</em>. Then we’ll <em>EncodeToPNG</em> to store it in the array of bytes. We’ll store this array in our <em>ActiveCase</em> object, which is being maintained by the current instance of our <em>UIManager</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*VViCajDe68wuwl7Vt6VjEA.png" /></figure><p>Here’s an example of what our encoded image would look like if we saved it on our system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*nXA2vrqvAIOvS9DuS5XqGA.png" /><figcaption>A small portion of our pic’s .dat file.</figcaption></figure><p>Now we have to reverse the process to recreate the photo. We’ll create an empty <em>Texture2D</em> to hold the result. Then we’ll get the <em>PhotoTaken</em> byte array from the <em>ActiveCase</em> object and use the <em>LoadImage</em> method to assign the data to the <em>Texture2D</em>. Finally, we’ll assign the <em>Texture2D</em> to <em>texture </em>property of our <em>RawImage</em> object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*AMaON0xP0J-5LufhWVIrnQ.png" /></figure><p>It seems like a complicated process, but it only took a few lines of code!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82af70b36853" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Taking a Photo in Unity]]></title>
            <link>https://lordkakabel.medium.com/taking-a-photo-in-unity-e6e3f5328da6?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6e3f5328da6</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[indie-game-dev]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Mon, 06 Sep 2021 14:38:34 GMT</pubDate>
            <atom:updated>2021-09-09T03:50:41.091Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Allow the user to take a photo on their device to use in our program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*k0aOSVfFqIcjidj9ylWbHA.png" /></figure><p>One of the great things about Unity is we don’t have to “reinvent the wheel.” There are a lot of great — even free — assets we can import and use in our projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*k1eWLsVpde7mj-AmhtY3GQ.png" /></figure><p><em>Native Camera for Android &amp; iOS</em> by <em>yasirkula</em> one of these great, free assets. Simply download it from the <em>Asset Store</em> and import it in your project. In the <em>README</em> file, you’ll find a link to the project’s Github.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*U9aKToXE_7Up6dVIN6jrFQ.png" /></figure><p>This link will lead you to some example code snippets. The one we are interested in is the <em>TakePicture</em> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*fIVnV_0PKwP5LNByVgSF8w.png" /></figure><p>We’ll copy and paste this into our own script and modify it for our uses. The code will check to make sure our app has permission to access the user’s camera. If we do, we’ll store the picture as a <em>Texture2D</em>. We’ll assign that texture to our <em>PhotoTaken</em> object (which is of the <em>RawImage</em> type) and set it to active to display the picture. We’ll also store the path to where the image is located — we’ll need this for tomorrow’s article!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*6tgOZha4qN_8qlPkIc0sKQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6e3f5328da6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI Button Navigation without Code]]></title>
            <link>https://lordkakabel.medium.com/ui-button-navigation-without-code-64037c9ec0f7?source=rss-d2f7e0b43afe------2</link>
            <guid isPermaLink="false">https://medium.com/p/64037c9ec0f7</guid>
            <category><![CDATA[indie-game-development]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[made-with-unity]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Ryan Sweigart]]></dc:creator>
            <pubDate>Sun, 05 Sep 2021 17:53:57 GMT</pubDate>
            <atom:updated>2021-09-06T07:48:24.694Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objective:</strong> Activate and deactivate UI elements without code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*Jr2umnXmEUZekJV55kE76w.gif" /></figure><p>Our <em>Button</em> components have an <em>On Click ()</em> property. We can use this property to enable and disable other objects during runtime.</p><p>We can simply click the <em>+</em> icon to add as many fields as we need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*NCnT_BpdEGbK73FgPR-K7Q.png" /></figure><p>Then we’ll drag the object we want to manipulate into a field. From the field’s dropdown menu, we’ll select <em>GameObject →SetActive (bool)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*z8kAVTvLsN-uGasxgqKC7g.png" /></figure><p>The we check the box if we want that object to be active when the button is clicked, and uncheck it if the object should deactivate.</p><p>In this example, when the user clicks the <em>Find Case #</em> button, the <em>Search Panel</em> and <em>Border Panel</em> objects will activate, and the <em>Main Menu</em> object will deactivate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*mTZFHhhxfs3QRkp9n3FZNw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64037c9ec0f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>