<?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 Kristopher C. Tobiasson on Medium]]></title>
        <description><![CDATA[Stories by Kristopher C. Tobiasson on Medium]]></description>
        <link>https://medium.com/@kristobiasson?source=rss-665c50d52cbf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SHr-TKKZE1JRNeDEN0PQVg.jpeg</url>
            <title>Stories by Kristopher C. Tobiasson on Medium</title>
            <link>https://medium.com/@kristobiasson?source=rss-665c50d52cbf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 02:31:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kristobiasson/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[Mastering Unit Testing in Unity 3D]]></title>
            <link>https://kristobiasson.medium.com/mastering-unit-testing-in-unity-3d-8c8805accf1a?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c8805accf1a</guid>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Thu, 08 Jun 2023 16:12:52 GMT</pubDate>
            <atom:updated>2023-06-09T07:24:40.896Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mC4t9zqKh2UpROezHYMcNQ.jpeg" /></figure><p>For a professional Unity developer, unit testing is a crucial skill. We all want to validate the quality and correctness of our code and unit testing allows us to do just that. However, it isn’t always clear how to test in certain situations in Unity. For example, MonoBehaviours are not directly mock-able and this can sometimes cause confusion at first encounter. Well, I’m going to shed some light on issues like that in this article as I’ll explain some ways in which we can test just about anything you can imagine in the Unity editor with some useful tricks.</p><p>First of all we need to get setup for unit testing in Unity. So we’ll need the following packages installed:</p><ul><li>Test Framework package</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*qeYjwJ7OMAQvnC3z4ECuFQ.png" /></figure><ul><li>NSubstitue package (This is not in the unity registry and has to be downloaded via the git link: <a href="https://github.com/Thundernerd/Unity3D-NSubstitute.git">https://github.com/Thundernerd/Unity3D-NSubstitute.git</a>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*3G4jq8yN6Ybf9xcULfTelA.png" /></figure><p>I use Zenject as a DI framework in this example. Whether you choose to use Zenject, any other DI framework or no DI at all it shouldn’t matter.</p><p>Now you want to create an assembly definition and call it anything that makes sense to you. I called it Tests. Set the following settings in the assembly definition:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*8CSKUgKncTnXqiioCioNOA.png" /></figure><p>So now we need a unit to test. I’m going to keep things as short and sweet as possible by just setting up a test for a very simple class, but the principles used here can be expanded upon and used in very complex situations. One thing to keep very clear is that we only care about testing the class in question and we should try to mock everything else as much as possible or we can get into a dependency nightmare where you have to create dependencies of dependencies of depend…. I think you get the idea.</p><p>I thought it would be straightforward enough to create a basic cooling system for a computer. This is the class that we are going to test:</p><pre>using UnityEngine;<br>using UnityEngine.UI;<br>using Zenject;<br><br>namespace Tests<br>{<br>    public class CoolingSystem : MonoBehaviour<br>    {<br>        [SerializeField] <br>        private Image coolingIndicatorLight;<br>        private IFan fan;<br>        private ITemperatureControllable cpuTempControl;<br><br>        [Inject]<br>        private void Inject(<br>            IFan fan,<br>            [Inject(Id = &quot;cpuTempControl&quot;)] <br>            ITemperatureControllable cpuTempControl)<br>        {<br>            this.fan = fan;<br>            this.cpuTempControl = cpuTempControl;<br>        }<br><br>        private void Start()<br>        {<br>            coolingIndicatorLight.color = GetIntensityColor(IntensityLevel.None);<br>        }<br><br>        private void Update()<br>        {<br>            CheckHeatIntensity();<br>        }<br><br>        private void CheckHeatIntensity()<br>        {<br>            var heatIntensity = cpuTempControl.GetHeatIntensity();<br><br>            if (heatIntensity != fan.FanSpeedIntensity)<br>            {<br>                fan.UpdateFanSpeed(heatIntensity);<br>                coolingIndicatorLight.color = GetIntensityColor(heatIntensity);<br>            }<br>            if (heatIntensity == IntensityLevel.Outrageous)<br>                BlowUp();<br>        }<br><br>        private Color GetIntensityColor(IntensityLevel intensity)<br>        {<br>            return intensity switch<br>            {<br>                IntensityLevel.None =&gt; Color.clear,<br>                IntensityLevel.Minimum =&gt; Color.blue,<br>                IntensityLevel.Normal =&gt; Color.green,<br>                IntensityLevel.Maximum =&gt; Color.red,<br>                IntensityLevel.Outrageous =&gt; Color.magenta,<br><br>                _ =&gt; throw new System.ArgumentOutOfRangeException()<br>            };<br>        }<br><br>        private void BlowUp() =&gt; Destroy(this);<br>    }<br>}</pre><p>As you can see, there are just 3 dependencies (the coolingIndicatorLight Image, and the fan and cpuTempControl injected with the Zenject Inject attribute). We can mock the 2 interfaces with NSubstitute, but we can’t mock the Image since it inherits from MonoBehaviour. No problem, we can use Reflection for dealing with the Image as a dependency and we can also use Reflection for accessing and Invoking the GetIntensityColor method.</p><p>Here are the 2 interface dependencies and the IntensityLevel enum just in case it wasn’t already clear how the looked:</p><pre>namespace Tests<br>{<br>    public interface IFan<br>    {<br>        IntensityLevel FanSpeedIntensity { get; }<br>        void UpdateFanSpeed(IntensityLevel fanSpeed);<br>    }<br>}</pre><pre>namespace Tests<br>{<br>    public interface ITemperatureControllable<br>    {<br>        IntensityLevel GetHeatIntensity();<br>    }<br>}</pre><pre>namespace Tests<br>{<br>    public enum IntensityLevel<br>    {<br>        None,<br>        Minimum,<br>        Normal,<br>        Maximum,<br>        Outrageous<br>    }<br>}</pre><p>We don’t care about the concrete versions of those interface dependencies because they are outside of the scope of the “unit” that we are testing against. So, since we only care about the CoolingSystem class, what are the unit tests that we should perform? Well, starting from the top and working our way down, we have the following unit tests:</p><ol><li>Test that the “coolingIndicatorLight.color” is properly set in the Start() method is a great start.</li><li>Test all the possible combinations of IntensityLevels of the fan and cpuTempControl to make sure the UpdateFanSpeed method is called with the correct IntensityLevel as it should when the intensity levels don’t match.</li><li>Test that a cpuTempControl heat of IntensityLevel.Outrageous destroys the CoolingSystem object.</li></ol><pre>using System.Collections;<br>using System.Reflection;<br>using NSubstitute;<br>using NUnit.Framework;<br>using UnityEngine.TestTools;<br>using UnityEngine;<br>using UnityEngine.UI;<br>using Zenject;<br><br>namespace Tests<br>{<br>    public class CoolingSystemTests<br>    {<br>        private DiContainer container;<br>        private Image coolingIndicatorLight;<br>        private IFan fan;<br>        private ITemperatureControllable cpuTempControl;<br>        private CoolingSystem coolingSystem;<br><br>        [SetUp]<br>        public void SetUp()<br>        {<br>            container = new DiContainer();<br><br>            fan = Substitute.For&lt;IFan&gt;();<br>            cpuTempControl = Substitute.For&lt;ITemperatureControllable&gt;();<br><br>            container.Bind&lt;IFan&gt;().FromInstance(fan).AsSingle();<br>            container.Bind&lt;ITemperatureControllable&gt;().WithId(&quot;cpuTempControl&quot;).FromInstance(cpuTempControl).AsSingle();<br><br>            var gameObject = new GameObject();<br>            gameObject.SetActive(false);<br>            coolingSystem = gameObject.AddComponent&lt;CoolingSystem&gt;();<br>            container.Inject(coolingSystem);<br>            SetupIndicatorLightImage();<br>        }<br><br>        [UnityTest]<br>        public IEnumerator Start_IndicatorLightColor_Test()<br>        {<br>            coolingSystem.gameObject.SetActive(true);<br><br>            yield return null;<br><br>            var intensityColor = GetIntensityColor(IntensityLevel.None);<br><br>            Assert.AreEqual(coolingIndicatorLight.color, intensityColor);<br>        }<br><br>        private static IntensityLevel[] intensityLevels = new [] { <br>            IntensityLevel.None, <br>            IntensityLevel.Minimum, <br>            IntensityLevel.Normal, <br>            IntensityLevel.Maximum,<br>            IntensityLevel.Outrageous<br>        };<br><br>        [UnityTest]<br>        public IEnumerator UpdateFanSpeed_Test(<br>            [ValueSource(nameof(intensityLevels))] IntensityLevel heatIntensity,<br>            [ValueSource(nameof(intensityLevels))] IntensityLevel fanIntensity)<br>        {<br>            cpuTempControl.GetHeatIntensity().Returns(heatIntensity);<br>            fan.FanSpeedIntensity.Returns(fanIntensity);<br><br>            coolingSystem.gameObject.SetActive(true);<br><br>            yield return null;<br><br>            cpuTempControl.Received(1).GetHeatIntensity();<br><br>            if (heatIntensity != fanIntensity)<br>            {<br>                var intensityColor = GetIntensityColor(heatIntensity);<br><br>                fan.Received(1).UpdateFanSpeed(heatIntensity);<br>                Assert.AreEqual(coolingIndicatorLight.color, intensityColor);<br>            }<br>            else<br>                fan.DidNotReceive().UpdateFanSpeed(Arg.Any&lt;IntensityLevel&gt;());<br>        }<br><br>        [UnityTest]<br>        public IEnumerator IntensityLevel_OutrageousDestroysCoolingSystem_Test()<br>        {<br>            cpuTempControl.GetHeatIntensity().Returns(IntensityLevel.Outrageous);<br>            fan.FanSpeedIntensity.Returns(IntensityLevel.None);<br><br>            coolingSystem.gameObject.SetActive(true);<br><br>            yield return null;<br>            yield return null;<br><br>            Assert.IsTrue(coolingSystem == null);<br>        }<br><br>        private Color GetIntensityColor(IntensityLevel intensityLevel) =&gt; <br>            (Color) GetPrivateMethod(coolingSystem, &quot;GetIntensityColor&quot;)<br>                .Invoke(coolingSystem, new object[] {intensityLevel});<br><br>        private void SetupIndicatorLightImage()<br>        {<br>            coolingIndicatorLight = coolingSystem.gameObject.AddComponent&lt;Image&gt;();<br>            SetPrivateField(coolingSystem, &quot;coolingIndicatorLight&quot;, coolingIndicatorLight);<br>        }<br><br>        public MethodInfo GetPrivateMethod(object someObject, string methodName) =&gt;<br>            someObject.GetType()<br>                .GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance);<br><br>        private void SetPrivateField(object someObject, string fieldName, object value) =&gt; <br>            someObject.GetType()<br>                .GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance)?<br>                .SetValue(someObject, value);<br>    }<br>}</pre><p>Now let’s go through that code:</p><ol><li>We start by defining variables that we are going to use in each test at the top.</li><li>We have our SetUp method after our SetUpAttribute to tell Unity to run this common setup functionality before each unit test.</li><li>Inside the SetUp function we create a mocked version of our interface dependencies and we bind them to our DiContainer including the expected Id for the ITemperatureControllable instance.</li><li>Continuing with the setup, we create a GameObject which will contain our CoolingSystem class, but before we add the CoolingSystem and inject it into the DiContainer, we set it inactive to ensure that Awake/OnEnable don’t run on it before injection (even though we don’t actually use those methods, injecting before anything else is a good habit to get into).</li><li>To finish off our setup, we create/resolve our final dependency, the Image. We do this by setting the private field with Reflection. That was a piece of cake!</li><li>Now all of our dependencies are correctly resolved and we have done everything by code without the need for setting up additional “test” Prefabs in our project which I like to stay away from if I can.</li><li>Now we tell Unity about our test by supplying the UnityTestAttribute before the function. I called our first test “Start_IndicatorLightColor_Test”.</li><li>In this first test we are simply testing to make sure that the correct colour is set on the coolingIndicatorLight Image. We get a bit cheeky here by using Reflection to Invoke the private GetIntensityColor method to get the expected Color and test it against the Image’s color property. You may be asking yourself, “aren’t we supposed to be testing that class and assuming that it might not work as expected? If so, why are we invoking a private function inside the class?” You got me!! But my rebuttal is that the function is very simple and you could unit test the private function itself with Reflection to set your mind at ease. AND I wouldn’t have been able to show you that trick otherwise so don’t be so hard on me.</li><li>Our next test, “UpdateFanSpeed_Test”, is actually multiple tests in one (25 to be exact, you can confirm in the Test Runner window) as it tests every combination of the input parameters based on the ValueSourceAttribute IntensityLevel array that we pass for each parameter.</li><li>In this second test we are setting the mocked interface properties via the Returns method to match the input parameters and if heatIntensity and fanIntensity are not equal, we check to make sure that the UpdateFanSpeed method is called with the expected IntensityLevel and we ensure that the coolingIndicatorLight.color is set properly as before. If heatIntensity and fanIntensity are equal we check to make sure that the UpdateFanSpeed method was not called at all.</li><li>Moving on to our final test, “IntensityLevelOutrageousDestroysCoolingSystem_Test”, we check to make sure the coolingSystem gets destroyed. Everything is quite similar to the previous test other than we add an additional yield statement to give the object an additional frame to become null.</li></ol><p><em>You might notice that I turn the coolingSystem.gameObject back to active just before the first yield statement in each test and that is because I like to wait for all things to be setup before allowing the component I’m testing against to start running any code other than the Inject method.</em></p><p>I hope this article helps give you an idea of some useful tricks you can use while unit testing in Unity.</p><p>One thing that I didn’t cover here is to clean up the test scene between unit tests. It is a good idea to do a proper tear down by using the UnityTearDownAttribute and destroying all of the objects that you created for your unit test (not the ones that Unity uses for the test runner though).</p><p>In summary, you can test just about anything you need with the help from NSubstitute and Reflection. Sometimes you need to get a bit creative, but where there is a will, there is a way!!</p><p>Now you have no excuse to not keep that test coverage up!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c8805accf1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Idea Jam Results Are In!!]]></title>
            <link>https://medium.com/everdevs-community/the-idea-jam-results-are-in-ebbeefa9ab3b?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebbeefa9ab3b</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[opportunity]]></category>
            <category><![CDATA[indie-game]]></category>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Wed, 02 Jun 2021 15:42:53 GMT</pubDate>
            <atom:updated>2021-06-02T15:42:53.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*9ygQMOQzvBydraULZSL31g.png" /><figcaption>Clue: Murder by Death by Xavi Pallicera</figcaption></figure><p>Game Designers from all over the world competed over the last month in the first game idea game jam ever hosted by Everdevs. Thanks to all contestants who participated, and congratulations to the fourteen contestants who presented exceptional work and earned a share in future net profits of the game that we will create based on the winning idea.</p><p>Although there is only one winner, everyone who goes beyond the call of duty gets rewarded in our game jams because we are a community of indie game devs, and we do everything we can to support each other.</p><p>The winning idea of The Idea Jam was a game called “Clue: Murder by Death” by Xavi Pallicera (picture above). Xavi earned 1000 Dev Points. (Dev Points represent a contestant’s stake in the profit-share)</p><blockquote>“It is an adventure game where the user must survive a night in an English castle after a murder has taken place during dinner. Set in the early twentieth century, it is a modern parody of detective adventures where, in addition to surviving, you must discover who the murderer is by playing with different characters.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*5ha8VY_3hE9vvcwKb65liQ.jpeg" /></figure><p>“Archer — Epic Untold” by Shikhar Juyal was a close second. Archer hosted a unique game mechanic, which I won’t go into detail about for the sake of confidentiality. Shikhar earned 500 Dev Points.</p><p>“The No-Seer Troubadour” by Victor Andrade and Pedro “Cabelinho” came in 3rd place. It was an action-adventure game featuring a dishonest musician. Victor Andrade and Pedro “Cabelinho” earned 250 Dev Points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*KuF_38Tga9ZOd20C2Is--Q.png" /></figure><p>The following game ideas received 50 Dev Points each:</p><p>“Mercy” by Eurinomio<br>“The Takers” by Mark Skinner<br>“Ground Zero” by Irene Marina Barbé<br>“Eternal Suffering” by KamuiofSorrow<br>“Euphony — Symphony of War” by Leon Fernandes<br>“Dark Steed” by Maha Nawaz<br>“Feral Hydration” by Jesse Calder<br>“The Epic Untold” by Sayantan Choudhary<br>“Dr. Sam’s Memory Palace” by Samuel Parera<br>“Echo Black” by Ethan Bristowe<br>“Dawn Upon” by N4tsu</p><p>Thanks again to everyone who participated in The Idea Jam. We’re looking forward to seeing you in future game jams.</p><p>We are excited to start the development of “Clue: Murder by Death.” We will be hosting another game jam shortly to discover what other indie game devs are interested in being a part of the development of this unique adventure game.</p><p><a href="https://everdevs.itch.io/">Follow us on itch</a> and stay tuned for the next game jam!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebbeefa9ab3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/everdevs-community/the-idea-jam-results-are-in-ebbeefa9ab3b">The Idea Jam Results Are In!!</a> was originally published in <a href="https://medium.com/everdevs-community">Everdevs Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Calling All Game Devs, Designers, and Writers]]></title>
            <link>https://medium.com/everdevs-community/calling-all-game-devs-designers-and-writers-57d5f2bc3efc?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/57d5f2bc3efc</guid>
            <category><![CDATA[opportunity]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Wed, 28 Apr 2021 08:51:28 GMT</pubDate>
            <atom:updated>2021-04-28T09:33:30.220Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s Get Jammin!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*BW-83Yks2nGoSKoeRLQzYg.png" /><figcaption>“I wanna jam it wid you. We’re jammin’, jammin’,<br>And I hope you like jammin’, too.” — Bob Marley</figcaption></figure><p>It’s time!! The first <a href="https://www.everdevs.com/">Everdevs</a> game jam is upon us. “<a href="https://www.everdevs.com/projects/gamejam/5f46c7ee3013781969498f23">The Idea Jam</a>” will set the pace of development for the game currently known as “The Epic Untold.” As you may have guessed by the name, The Idea Jam is a competition where game devs, designers, and writers compete by creating a clear and comprehensive presentation of their game ideas following the criteria shown on <a href="https://www.everdevs.com/projects/gamejam/5f46c7ee3013781969498f23">The Idea Jam’s page</a>.</p><p>The winning game idea from this competition will go on to be developed by the Everdevs community one step at a time with subsequent game jams. 80 percent of the net profits generated by the game created as a result of contributing game jams, will be shared amongst the top 3 contestants of each.</p><p><strong><em>When we win, we win together!!</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*873BrOanzOEFXd1X-tQN4Q.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/peggy_marco-1553824/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=1010918">Peggy und Marco Lachmann-Anke</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=1010918">Pixabay</a></figcaption></figure><p><a href="https://www.everdevs.com/signup"><strong><em>Create an account</em></strong></a><strong><em> and join </em></strong><a href="https://www.everdevs.com/projects/gamejam/5f46c7ee3013781969498f23"><strong><em>The Idea Jam</em></strong></a><strong><em> now!!</em></strong></p><p>The Idea Jam is currently open for registration, and members are free to start working on their game ideas immediately after signing up. There are just 100 slots available, so don’t wait long!</p><p>Keep in mind that this is not a typical game jam where participants must create a complete game prototype within 72 hours. We believe that quality and haste don’t mix well. Therefore, we have allotted approximately one month for members to prepare and deliver their best work. There is no start date for this game jam, but the deadline for submissions is on or before May 28th, 2021.</p><p><strong><em>It’s a Win-Win!!</em></strong></p><p>Although not everyone can be a winner, hard work should never go unnoticed. Therefore, participants that go beyond the call of duty will, upon their approval, have their feats included in a post-game jam article that we write and publish right here on our Medium publication. We then share the article across our various social network channels of over 11k+ game industry professionals globally. We do this because it is our mission, above all else, to help our members realize success.</p><p>Success can take many shapes and forms, and we believe that Everdevs members can measure their success in the following ways:</p><ul><li>Receiving a gold, silver, or bronze medal achievement for excellent performance in a game jam. Medalists are eligible for the prizes described on the corresponding game jam page.</li><li>Finding job placement with one of our partners. Our partners, principally game studios, frequently look for professionals to fill their remote and in-house positions. We offer such partners the ability to share these job opportunities with our active top-performing members. Additionally, they can opt to hold events with Everdevs where job placement is the prize for the winning contestants.</li><li>Learning a new skill or honing an existing one while participating in our events. This should be the goal of all of the participants of our game jams.</li></ul><p><strong><em>Credibility cannot endure without quality.</em></strong></p><p>In addition to our member-first mentality, we are committed to creating top-quality games. Therefore, we maintain high standards when analyzing submissions of game jams. Occasionally, when none of the submitted work of a given game jam is satisfactory, we may call for a repeat of the game jam. We do this to preserve the integrity of the Everdevs community, a principle that is as important for us as it is for our valued members and clients.</p><p>We are looking forward to reviewing your submissions. If you have any inquiries, please don’t hesitate to contact us at <a href="/service/mailto: info@everdevs.com">info@everdevs.com</a>.</p><p><em>We wish you the best of luck!!</em></p><p><em>**For general info, refer to the </em><a href="https://www.everdevs.com/about"><em>About page</em></a><em> of our website (</em><a href="https://everdevs.com/"><em>www.everdevs.com</em></a><em>).</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57d5f2bc3efc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/everdevs-community/calling-all-game-devs-designers-and-writers-57d5f2bc3efc">Calling All Game Devs, Designers, and Writers</a> was originally published in <a href="https://medium.com/everdevs-community">Everdevs Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide to Using Google’s New Maps SDK for Unity 3D - Part 3]]></title>
            <link>https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-3-fb2a7927e8b8?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb2a7927e8b8</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[google-maps]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Sat, 24 Apr 2021 10:36:53 GMT</pubDate>
            <atom:updated>2023-06-10T08:11:57.777Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Part 3: Map Customization</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Pj1qdQfToQSrOZ0ckWDNw.jpeg" /><figcaption><a href="https://www.freepik.com/vectors/tree">Tree vector created by macrovector</a> — <a href="http://www.freepik.com/">www.freepik.com</a></figcaption></figure><p><em>Note 1: The Maps Sdk from Google is now deprecated ⚠️ . This is the third part of this guide. It is assumed that you have completed </em><a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-ed1d68b2305e"><em>Part 1: Project Setup</em></a><em> and </em><a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-2-cff0d7225300"><em>Part 2: Map Scene Setup</em></a><em> starting this tutorial.</em></p><p><em>Note 2: This tutorial contains C# code snippets. In order to get the most out of this tutorial, it is recommended that you have, at least, basic knowledge in C# and Unity 3D development.</em></p><p>In the previous tutorial, we created a new map scene in Unity and populated it with some GameObjects. We learned that the Maps Service component is where the bulk of the magic happens in the SDK. As Google says, “The <a href="https://developers.google.com/maps/documentation/gaming/reference/unity/class/google/maps/maps-service">MapsService</a> class serves as the entry point for interacting with the Maps SDK for Unity.”</p><p>Lastly, we created the MobileDeviceLocationFollower class which allows us to track the location of a mobile device in the real world and project its position onto the map of our game world. We also included a helper class, MobileDeviceEditorController, which enables us to mock the movement and vertical rotation of our MobileDevice object while we are in the Unity Editor. Then we did a little test run in front of the Sagrada Familia Cathedral in Barcelona, Spain.</p><p><strong><em>Time to get styling!!</em></strong></p><p><strong>Styling the Map:</strong></p><p>If you were paying attention in the previous tutorial, you would have noticed that when we loaded the map in the MobileDeviceLocationFollower, we passed ExampleDefaults.DefaultGameObjectOptions as the second parameter. That created our map’s regional styling for us using the default styles of the shared SDK examples. That’s great, but it’s likely that you’re going to want a bit more control over how your map looks. Let’s create a new script which will help us get our hands dirty with the design.</p><p>Open your scripts folder and do the following:</p><ul><li>add a new subfolder called “MapStyles”.</li><li>Inside the MapStyles folder, add a new script called “MapFeaturesController”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*hcMYbX-nZ6r0ZBGYe0FIwQ.png" /><figcaption>What the scripts folder should look like.</figcaption></figure><p>Open the newly created class and paste the following code: (Sorry, the code formatting is impossible to get perfect in Medium)</p><pre>using Google.Maps;<br>using Google.Maps.Event;<br>using Google.Maps.Feature;<br>using Google.Maps.Feature.Style;<br>using Google.Maps.Unity.Intersections;<br>using UnityEngine;<br>using System.Collections.Generic;</pre><pre>namespace TestApp.MapFeatures<br>{<br>    public class MapFeaturesController: MonoBehaviour<br>    {<br>        [SerializeField] private MapsService _mapsService;</pre><pre>        [Header(&quot;Materials&quot;)]</pre><pre>        [SerializeField] private Material _intersectionMaterial;<br>        [SerializeField] private Material _roadMaterial;<br>        [SerializeField] private Material _roadBorderMaterial;<br>        [SerializeField] private Material _waterMaterial;<br>        [SerializeField] private Material _beachMaterial;<br>        [SerializeField] private Material _grassMaterial;<br>        [SerializeField] private Material _unspecifiedRegionMaterial;<br>        [SerializeField] private Material _modeledStructureMaterial;<br>        [SerializeField] private Material _defaultBuildingWallMaterial;<br>        [SerializeField] private Material _defaultBuildingRoofMaterial;</pre><pre>        private float _roadWidth = 4;</pre><pre>        [Header(&quot;Region Togglers&quot;)]</pre><pre>[SerializeField] private bool _showExtrudedStructures = true;<br>        [SerializeField] private bool _showModeledStructures = true;<br>        [SerializeField] private bool _showRegions = true;<br>        [SerializeField] private bool _showSegments = true;<br>        [SerializeField] private bool _showAreaWater = true;<br>        [SerializeField] private bool _showLineWater = true;<br>        [SerializeField] private bool _showIntersections = true;</pre><pre>        public static GameObjectOptions DefaultGameObjectOptions;</pre><pre>        private RegionStyle _defaultRegionStyle;<br>        private SegmentStyle _defaultSegmentStyle;<br>        private AreaWaterStyle _defaultAreaWaterStyle;<br>        private LineWaterStyle _defaultLineWaterStyle;<br>        private ModeledStructureStyle _defaultModeledStructureStyle;<br>        private ExtrudedStructureStyle _defaultExtrudedStructureStyle;</pre><pre>        private void Awake()<br>        {<br>            if (_mapsService == null)<br>                Debug.Log(&quot;Maps Service is required for this script to work.&quot;);</pre><pre>            _defaultRegionStyle = new RegionStyle.Builder {<br>                FillMaterial = _grassMaterial,<br>            }.Build();</pre><pre>            _defaultSegmentStyle = new SegmentStyle.Builder {<br>                Material = _roadMaterial,<br>                Width = _roadWidth,<br>                BorderMaterial = _roadBorderMaterial,<br>                BorderWidth = 0.6f<br>            }.Build();</pre><pre>            _defaultAreaWaterStyle = new AreaWaterStyle.Builder {<br>                FillMaterial = _waterMaterial<br>            }.Build();</pre><pre>            _defaultLineWaterStyle = new LineWaterStyle.Builder {<br>                Material = _waterMaterial<br>            }.Build();</pre><pre>            _defaultModeledStructureStyle = new ModeledStructureStyle.Builder {<br>                Material = _modeledStructureMaterial<br>            }.Build();</pre><pre>            _defaultExtrudedStructureStyle = new ExtrudedStructureStyle.Builder {<br>                WallMaterial = _defaultBuildingWallMaterial,<br>                RoofMaterial = _defaultBuildingRoofMaterial<br>            }.Build();</pre><pre>            DefaultGameObjectOptions = new GameObjectOptions {<br>                ExtrudedStructureStyle = _defaultExtrudedStructureStyle,<br>                ModeledStructureStyle = _defaultModeledStructureStyle,<br>                RegionStyle = _defaultRegionStyle,<br>                AreaWaterStyle = _defaultAreaWaterStyle,<br>                LineWaterStyle = _defaultLineWaterStyle,<br>                SegmentStyle = _defaultSegmentStyle,<br>            };<br>        }</pre><pre>        private void OnEnable()<br>        {<br>            if (_mapsService == null)<br>                return;</pre><pre>            _mapsService.Events.ExtrudedStructureEvents.WillCreate.AddListener(OnWillCreateExtrudedStructure);<br>            _mapsService.Events.ModeledStructureEvents.WillCreate.AddListener(OnWillCreateModeledStructure);<br>            _mapsService.Events.RegionEvents.WillCreate.AddListener(OnWillCreateRegion);<br>            _mapsService.Events.SegmentEvents.WillCreate.AddListener(OnWillCreateSegment);<br>            _mapsService.Events.AreaWaterEvents.WillCreate.AddListener(OnWillCreateAreaWater);<br>            _mapsService.Events.LineWaterEvents.WillCreate.AddListener(OnWillCreateLineWater);<br>            _mapsService.Events.IntersectionEvents.WillCreate.AddListener(OnWillCreateIntersection);</pre><pre>            _mapsService.Events.RegionEvents.DidCreate.AddListener(OnRegionCreated);<br>            _mapsService.Events.SegmentEvents.DidCreate.AddListener(OnSegmentCreated);<br>        }</pre><pre>        void OnDisable()<br>        {<br>            if (_mapsService == null)<br>                return;</pre><pre>            _mapsService.Events.ExtrudedStructureEvents.WillCreate.RemoveListener(OnWillCreateExtrudedStructure);<br>            _mapsService.Events.ModeledStructureEvents.WillCreate.RemoveListener(OnWillCreateModeledStructure);<br>            _mapsService.Events.RegionEvents.WillCreate.RemoveListener(OnWillCreateRegion);<br>            _mapsService.Events.SegmentEvents.WillCreate.RemoveListener(OnWillCreateSegment);<br>            _mapsService.Events.AreaWaterEvents.WillCreate.RemoveListener(OnWillCreateAreaWater);<br>            _mapsService.Events.LineWaterEvents.WillCreate.RemoveListener(OnWillCreateLineWater);<br>            _mapsService.Events.IntersectionEvents.WillCreate.RemoveListener(OnWillCreateIntersection);</pre><pre>            _mapsService.Events.RegionEvents.DidCreate.RemoveListener(OnRegionCreated);<br>            _mapsService.Events.SegmentEvents.DidCreate.RemoveListener(OnSegmentCreated);<br>        }</pre><pre>        void OnWillCreateExtrudedStructure(WillCreateExtrudedStructureArgs args)<br>        {<br>            args.Cancel = !_showExtrudedStructures;<br>        }</pre><pre>        void OnWillCreateModeledStructure(WillCreateModeledStructureArgs args)<br>        {<br>            args.Cancel = !_showModeledStructures;<br>        }</pre><pre>        void OnWillCreateRegion(WillCreateRegionArgs args)<br>        {<br>            if(_showRegions)<br>            {<br>                if(args.MapFeature.Metadata.Usage == RegionMetadata.UsageType.Beach)<br>                {<br>                    args.Style = new RegionStyle.Builder(args.Style){<br>                        FillMaterial = _beachMaterial<br>                    }.Build();<br>                }<br>                else if(args.MapFeature.Metadata.Usage != RegionMetadata.UsageType.Park<br>                     || args.MapFeature.Metadata.Usage != RegionMetadata.UsageType.Forest)<br>                    args.Style = new RegionStyle.Builder(args.Style){<br>                        FillMaterial = _unspecifiedRegionMaterial<br>                    }.Build();<br>            }<br>            else<br>                args.Cancel = true;<br>        }</pre><pre>        void OnWillCreateSegment(WillCreateSegmentArgs args)<br>        {<br>            if(_showSegments &amp;&amp; IsValidRoad(args.MapFeature))<br>            {<br>                if(!IsTraversableRoad(args.MapFeature))<br>                    args.Style = new SegmentStyle.Builder(args.Style) {<br>                        Material = _roadMaterial,<br>                        Width = _roadWidth * 0.5f,<br>                        BorderMaterial = _roadBorderMaterial,<br>                        BorderWidth = 0.3f<br>                    }.Build();<br>            }<br>            else<br>                args.Cancel = true;<br>        }</pre><pre>        void OnWillCreateAreaWater(WillCreateAreaWaterArgs args)<br>        {<br>            args.Cancel = !_showAreaWater;<br>        }</pre><pre>        void OnWillCreateLineWater(WillCreateLineWaterArgs args)<br>        {<br>            args.Cancel = !_showLineWater;<br>        }</pre><pre>        void OnWillCreateIntersection(WillCreateIntersectionArgs args)<br>        {<br>            if(_showIntersections)<br>            {<br>                args.Style = new SegmentStyle.Builder(args.Style) {<br>                    IntersectionMaterial = _intersectionMaterial,<br>                    IntersectionArmLength = _roadWidth,<br>                    IntersectionJoinLength = _roadWidth * 4,<br>                    MaxIntersectionArmDistance = _roadWidth * 5,<br>                    Width = _roadWidth<br>                }.Build();</pre><pre>                List&lt;IntersectionArm&gt; arms = new List&lt;IntersectionArm&gt;(args.MapFeature.Shape.Arms);</pre><pre>                foreach (IntersectionArm arm in arms)<br>                {<br>                    if (!IsTraversableRoad(arm.Segment))<br>                    {<br>                        arm.Cancel = true;<br>                        continue;<br>                    }<br>                }<br>            }<br>            else<br>                args.Cancel = true;<br>        }</pre><pre>        void OnRegionCreated(DidCreateRegionArgs args)<br>        {<br>            if (args.MapFeature.Metadata.Usage == RegionMetadata.UsageType.Park<br>             || args.MapFeature.Metadata.Usage == RegionMetadata.UsageType.Forest)<br>                args.GameObject.tag = &quot;Park&quot;;<br>        }</pre><pre>        void OnSegmentCreated(DidCreateSegmentArgs args)<br>        {<br>            if (args.MapFeature.Metadata.Usage != SegmentMetadata.UsageType.Highway<br>             || args.MapFeature.Metadata.Usage != SegmentMetadata.UsageType.ControlledAccessHighway<br>             || args.MapFeature.Metadata.Usage != SegmentMetadata.UsageType.Rail)<br>                args.GameObject.tag = &quot;Road&quot;;<br>        }</pre><pre>        public static bool IsTraversableRoad(Segment segment)<br>        {<br>            return segment.Metadata.Usage != SegmentMetadata.UsageType.Ferry<br>                &amp;&amp; segment.Metadata.Usage != SegmentMetadata.UsageType.Footpath<br>                &amp;&amp; segment.Metadata.Usage != SegmentMetadata.UsageType.Rail;<br>        }</pre><pre>        public static bool IsValidRoad(Segment segment)<br>        {<br>            return segment.Metadata.Usage != SegmentMetadata.UsageType.Ferry;<br>        }<br>    }<br>}</pre><p>Although the class is a bit long, it is actually just scratching the surface of what can be done as far as styling and manipulating Map Features. Let’s take a look at how this class works:</p><ul><li>We first declare all of our materials which will serve to give life to our map.</li><li>We supply a _roadWidth so we can control the width of our roads.</li><li>Then we create regional toggles/bools for each of the visible Map Features in our scene so we can switch them on/off. This is helpful when we just want to do some design work with just one Map Feature for example.</li><li>We declare our new static custom GameObjectOptions variable and the default styles which will make it up.</li><li>In the Awake() function, we build all of our default styles and pass them to the GameObjectOptions() constructor. So now our static DefaultGameObjectOptions variable can be used when calling theLoadMap() function of the Maps Service class.</li><li>In the OnEnable() function, we add our listeners to the appropriate WillCreate and DidCreate events.</li><li>In the OnDisable() function, we make sure to clean up after ourselves by removing the event listeners so we don’t get any memory leaks.</li><li>For the WillCreate listener functions of Extruded Structures, Modeled Structures, Area Water and Line Water, we merely just enable or disable the features according to the values of the respective booleans because we are happy with the default styles we applied in the Awake() function above.</li><li>Since our default style for Regions is _grassMaterial we need to build separate styles for the _beachMaterial and _unspecifiedRegionMaterial if we want to be able to distinguish between the regions on our map. So our OnWillCreateRegion() listener tests the MapFeature.Metadata.Usage of the WillCreateRegionArgs variable passed in by the event to see if it is a beach or unspecified region.</li><li>As we just saw with the Regions, our default Segment is one that represents a regular road, but a Segment can be a path, road, ferry route, etc.. So we want to filter through each Segment to make sure we don’t show the road style on a ferry route and also to change the width of paths to get a distinction from the default road.</li><li>For Intersections, we build our default style in the OnWillCreateIntersection() function and remove any arms of the Intersection which are projecting towards paths or nothing so as not to have any awkward looking Intersection arms on the map.</li><li>In the DidCreate listeners for Segments and Regions (OnRegionCreated() and OnSegmentCreated() ) we add tags to the instantiated GameObjects. I just put this tag assignment in the code as an example so you would know how to access the created GameObjects for further manipulation.</li><li>Finally we have our 2 static helper functions ( IsTraversableRoad() and IsValidRoad()) for finding out if we have valid (not ferry routes) and traversable (not ferry, footpath or rail routes) roads.</li></ul><p>As I said above, this script is just scratching the surface of how you can interact with the Map Features. You can expand on the DidCreate event listeners to apply parapets and borders on your buildings. You can change out the buildings for your own prefabs or add a squashing functionality that makes the buildings slowly go to the ground when your avatar gets close to them to ensure clear line of view from the camera. You could add an animated water effect. The list of what is possible goes on forever, but there are a lot of examples of what can be done in the SDK.</p><p>Ok, now do the following:</p><ul><li>Select your MapManager GameObject in the hierarchy that we created in the previous tutorial and add the MapFeaturesController class to it.</li><li>Thereafter, open your list of Tags and add “Road” and “Park” to the list.</li><li>Open your Materials folder and create 6 new materials with BaseMap Color shaders (Google/Maps/Shaders/BaseMap Color) and name them “Beach”, “Park”, “Road”, “RoadBorder”, “Water” and “UnspecifiedRegion”. Create another 3 new materials with Standard shaders and name them “Roof”, “Wall” and “ModeledStructure”. Create 1 more material with an Intersection shader (Google/Maps/Shaders/Intersection) and name it, you guessed it, “Intersection”. Adjust the colours of the new materials to your liking, but leave the Intersection material white.</li><li>Select the Intersection material so you can see its inspector. Go to Assets/GoogleMaps/Examples/04_Advanced/Intersections/Textures and drag the intersection-main-asphalt texture to the Albedo (RGB) slot of the material and drag the intersection-decal to the Arm Decal (RGB) slot of the material.</li><li>Open the MobileDeviceLocationFollower class and change the second parameter of the _mapsService.LoadMap() from Google.Maps.Examples.Shared.ExampleDefaults.DefaultGameObjectOptions to MapFeatures.MapFeaturesController.DefaultGameObjectOptions .</li><li>Now add all of the newly created materials to the respective slot on the MapFeaturesContoller component and add the Maps Service component to the Maps Service slot of the MapFeaturesController.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m6vRZ7NKiU_tc8gt1ic9YQ.png" /><figcaption>MapFeatures inspector and new Materials</figcaption></figure><p>If you press play now, you should see your map come to life with the materials you set…</p><p>Congratulations, you have come quite a ways and you should now understand how to get an how to get an API key, setup the Maps SDK to play nice with Unity, track the GPS of a device and project it’s position on the map in the game world, style your map and manipulate Map Feature GameObjects when they are created at runtime.</p><p>One important subject that I have not touched on in this guide is to update the FloatingPointOrigin. It is a very important concept, but it is thoroughly covered <a href="https://developers.google.com/maps/documentation/gaming/move_floating_origin">here</a>.</p><p>I hope you found this tutorial and guide helpful. If you would like me to create a tutorial which goes into further detail about something we have already touched on or another part of the SDK feel free to let me know in the comments below. Feedback is also very welcome as I would love to know what you think.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb2a7927e8b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-3-fb2a7927e8b8">A Guide to Using Google’s New Maps SDK for Unity 3D - Part 3</a> was originally published in <a href="https://medium.com/everdevs-community">Everdevs Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Was That My Birthday That Just Passed?]]></title>
            <link>https://kristobiasson.medium.com/was-that-my-birthday-that-just-past-aa0019b96930?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa0019b96930</guid>
            <category><![CDATA[love]]></category>
            <category><![CDATA[family]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[food]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Fri, 23 Apr 2021 21:20:12 GMT</pubDate>
            <atom:updated>2021-04-25T08:59:14.852Z</atom:updated>
            <content:encoded><![CDATA[<p>Next up… 40!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mT36zYg11jxtNisI20g1iQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@adigold1?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Adi Goldstein</a> on <a href="https://unsplash.com/s/photos/birthday?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>On my 39th birthday, I woke up to the tune of an unconventional alarm. At 730 in the morning, my wife and 2 daughters put in a valiant effort while singing me something which resembled your typical Happy Birthday song with the occasional word swapped out for its Spanish counterpart. A Happy Birthday remix is just one of the many perks that comes along with marrying a Canadian guy to a Spanish girl who then decide to procreate.</p><p>My age was portrayed creatively with 10 candles dispersed over 2 distinct desserts which huddled inside this fancy little box that my wife was carrying as she sang. On the left was a recycled candle in the shape of a 3 atop an oversized dollop of cream which I later found out had a cupcake dwelling beneath it. To its right was the second display, hosting 9 single happy face candles which were freely shedding wax all over the mini cheesecake they were stabbing below. The whole assortment obviously screamed “Breakfast of Champions!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkPgNgrQ7uK473jTBVVTxg.png" /><figcaption>Mmm, breakfast!</figcaption></figure><p>After the Spanglish version of Happy Birthday came to an end, I blew out my candles and focused my attention on the designer shopping bag which sat beside me on the bed. I recognized the obscure shoebox it contained from when the Amazon delivery guy heaved it over the fence at me just days before. “Hey, thanks, man..” 👋</p><p>A keen eye would likely discern that I was going to be getting shoes for my birthday. Nevertheless, I had all the reason to be sceptical about the notion before opening the box. Living in Barcelona where shoe stores tend to favor men with tiny little feet has the ability to damper the expectations of a guy whose shoe size competes with the likes of Shaquille O’Neal. Anyhow, my curiosity was peaking all the same..</p><p>To my surprise, I opened the box to find a slick new pair of the classic Arizona style Birkenstock sandals with 2 majestic brown leather straps. My wife nailed it again!! I’m guessing she’s trying to eliminate any possibility of my old blue pair of Birkenstocks coming back for yet another long season of the hot Spanish sunshine. She’s got a strong case really… They’re a size too small, stinky and quite simply beyond any reasonable state of salvation. Unfortunately, when slipping my oversized feet into the new sandals, we were all amazed to find out that there is footwear in existence that makes even my feet look considerably small. Note taken.. Birkenstock sandals fit big.</p><p>The festivities were over not 5 minutes after they had begun as the usual daily hustle and bustle understandably took precedence over my shoe size. However, I happened to score another sweet little surprise at night when my daughters went to town decorating the dining area with birthday paraphernalia.</p><p>They had been secretively handcrafting a massive multipart sign that said “HAppY BRiThdaY PaPA” for several days prior to the event. They somehow managed to fight about everything other than the misplaced “i” and “R” in “BRiThdaY” before they finally agreed that they should blindfold me and lead me downstairs to the party. When I entered the room, they immediately broke into song and dance which, I’m told, they had vigorously prepared for.</p><p>When the show was over, I was ordered to start steaming the artichokes and to get a couple of hot dogs grilling tout de suite because the entertainers had a big day and needed to be fed.</p><p>In the face of a pandemic, I have to say, that I’m pretty happy with the way my birthday turned out. All and all, it was a great day and I have tons to be thankful for, thanks to my 3 beautiful ladies.</p><p>I’m a software developer by day and a family guy by night. I joined medium to write tutorials on tech and stories about life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa0019b96930" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide to Using Google’s New Maps SDK for Unity 3D -  Part 2]]></title>
            <link>https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-2-cff0d7225300?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/cff0d7225300</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[google-maps]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Wed, 21 Apr 2021 20:44:24 GMT</pubDate>
            <atom:updated>2023-06-10T08:12:56.084Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Guide to Using Google’s New Maps SDK for Unity 3D - Part 2</h3><h4>Part 2: Map Scene Setup</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4wWotRnX7aioKYmabRzUg.jpeg" /><figcaption><a href="https://www.freepik.com/vectors/map">Map vector created by freepik</a> — <a href="http://www.freepik.com/">www.freepik.com</a></figcaption></figure><p><em>Note 1: The Maps Sdk from Google is now deprecated ⚠️. This is the second part of this guide. To go through the initial setup of the Google Maps SDK for Unity, please refer to “Part 1: Project Setup” </em><a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-ed1d68b2305e"><em>here</em></a><em>.</em></p><p><em>Note 2: This tutorial contains C# code snippets. In order to get the most out of this tutorial, it is recommended that you have, at least, basic knowledge in C# and Unity 3D development.</em></p><p>Although the project setup from the previous tutorial was fairly basic and perhaps even boring, it was a necessary obstacle to overcome. Without first getting an API key, google wouldn’t have served us any map data at all. In fact, we would have had numerous errors in the console had we not provided the API key to the “Maps Service” component before pressing play. The API key is how we identify ourselves with google so they know who to charge when we start getting roughly 20,000+ daily active users per month. So you can understand why they wouldn’t just blindly serve us data without first knowing who we are.</p><p><strong><em>Moving on…</em></strong></p><p><strong>Create the Map Scene and Populate It With Objects:</strong></p><p>Now that we have the Maps SDK playing nice with Unity, it’s time we go ahead and setup a custom scene. In the “Project” panel of Unity, open up the “Scenes” folder at the root of the Assets directory and rename “Sample Scene” to “Map”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/174/1*uuKpU81mRZn9TgBTCq4eiw.png" /><figcaption>Create custom Map scene</figcaption></figure><p>In the “Hierarchy” panel, do the following:</p><ul><li>Create 2 empty GameObjects and name one “GameWorld” and name the other “MapManager”.</li><li>Set the MainCamera and the DirectionalLight as children of the GameWorld object.</li><li>Create 2 more empty GameObjects and set them as children of the GameWorld object. Name these 2 new objects “Ground” and “MobileDevice”.</li></ul><p>Your Hierarchy should now look like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*JQCpX-Du7rd8VFxhbVSV5g.png" /><figcaption>Start populating the hierarchy</figcaption></figure><p>Select the MainCamera and change the Far field of the Clipping Planes to 5000. Don’t worry, we are not going to be loading 5 km of map data, we do this to ensure that the ground plane will not be clipped in the distance. Depending on your camera angle, a tightly clipped ground plane tends to be visually unpleasant if you get my drift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*_K-u3ZoA_lJMizikAkaiCg.png" /><figcaption>Change Clipping Planes Far to 5000</figcaption></figure><p>In the Assets folder of your Project, create a new folder named “Materials”. Within the Materials folder, create a new material named “GroundPlane”. Select the “BaseMap Color” shader in the dropdown menu of the newly created material (the shader path is Google/Maps/Shaders/BaseMap Color).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*ke7AEMtryW4IuKQsQwFF-g.png" /><figcaption>Create GroundPlane material</figcaption></figure><p>Select the Ground object in the hierarchy and do the following:</p><ul><li>Add a MeshFilter: Select a regular plane as the target mesh.</li><li>Add a MeshRenderer: Select the GroundPlane material we created as the target material.</li><li>Add a SortingGroup: Sorting Layer set to Default and Order in Layer set to -32768 (this is so as the ground plane does not render over top of any of the dynamically loaded objects of the map since the MapsService Min Basemap Sorting Order is -32767 by default).</li><li>Set the Transform Scale: (1000, 1, 1000)</li></ul><p>The inspector of the Ground object should now look like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*tUETYMh7T1XguwJ29gUkiA.png" /><figcaption>Setup the Ground</figcaption></figure><p>Select the MapManager object in the hierarchy and do the following:</p><ul><li>Add a DeviceCountryProvider.</li><li>Add a MapsService: Include your API key in the API key field and drag the DeviceCountryProvider to the Country Provider field. Under Map Feature Options, open Road Lattice and select Enable Road Lattice and then select Enable Intersections above. Leave the default values on the rest of the component.</li></ul><p><strong>The MapsService Component:</strong></p><p>The MapsService component is where most of the magic happens in the SDK. You can find an introduction to the component in the documentation <a href="https://developers.google.com/maps/documentation/gaming/concepts_musk">here</a>, but I’ll go ahead and give a little explanation on some properties worth noting:</p><ul><li>API Key: We already know about this one. This is where we paste our API key that we got in the previous <a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-ed1d68b2305e">tutorial</a> and it allows us to identify ourselves with google.</li><li>Zoom Level: Pretty self explanatory here. The zoom level of the map needs to be chosen before you run the game. You cannot change the zoom level of a map dynamically at runtime. To achieve multiple zoom levels, you would have to create multiple MapsService instances, each with a different zoom level. However, there are a couple built in components (MapLoader and MixedZoom) which can help in that department (check Assets/GoogleMaps/Examples/04_Advanced/MixedZoom scene for an example).</li><li>Country Provider: Let’s just leave this to the DeviceCountryProvider component. It does exactly as you would expect and there is no need to recreate the wheel.</li><li>Map Preview Options: These settings allow you to preview the map at edit time. Be careful though, you could unintentionally make changes to your project with this setting as the warning when you try to enable it suggests. However, it can make design workflow a bit easier at times.</li><li>Map Feature Options: For enabling all the necessary map features your scene needs. My features of choice are Modeled Structures, Intersections and Road Lattice. Modeled Structures (Statue of Liberty, Eiffel Tower, etc.) and Intersections are great for giving users a sense of realism while they use your app. Note that you must enable Road Lattice in order to use Intersections.</li><li>Events: The events which are fired by the SDK when loading the map and its features. This <a href="https://developers.google.com/maps/documentation/gaming/concepts_musk#types_of_events">page</a> of the documentation covers events well. For GameObject creation, WillCreate events are fired right after a MapFeature is created, but before the corresponding GameObject is created. DidCreate events are fired after the GameObject has been created and is a part of the scene.</li></ul><p>The other properties can generally be left alone unless you have a specific use case which calls for modifying them.</p><p>The MapManager inspector should currently look like the following image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*CJySmLpmK0laHn9Am5xIXQ.png" /><figcaption>MapManager inspector</figcaption></figure><p><strong>Tracking a Mobile Device on the Map:</strong></p><p>Tracking a mobile device and projecting its position on the map sounds a bit daunting at first if you’ve never done it before, but the Maps SDK has some handy functions which can help smooth out the process.</p><p>Do the following in the Project panel:</p><ul><li>Create a new folder in the Assets directory of your project and name it “Scripts”.</li><li>Create a new folder inside the Scripts folder and name it “MobileDevice”.</li><li>Create 2 new scripts inside the MobileDevice folder and name one of them “MobileDeviceEditorController”. Name the second script “MobileDeviceLocationFollower”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*mgnqGLOy_euuAU-HArTCpA.png" /><figcaption>MobileDevice scripts</figcaption></figure><p>Open the MobileDeviceEditorController and paste the following code:</p><pre>using UnityEngine;</pre><pre>namespace TestApp.MobileDevice<br>{<br>    public class MobileDeviceEditorController : MonoBehaviour<br>    {<br>        float _speed = 20.0f;<br>        <br>        void Update()<br>        {<br>            float _step = Time.deltaTime * _speed;<br>            <br>            if(Input.GetKey(KeyCode.UpArrow))<br>                transform.Translate(transform.forward * _step, Space.World);</pre><pre>            if(Input.GetKey(KeyCode.DownArrow))<br>                transform.Translate(-transform.forward * _step, Space.World );</pre><pre>            if(Input.GetKey(KeyCode.LeftArrow))<br>                transform.Rotate( 0, -3, 0 );</pre><pre>            if(Input.GetKey(KeyCode.RightArrow))<br>                transform.Rotate( 0, 3, 0 );<br>        }<br>    }<br>}</pre><p><em>Those of you who are unhappy that I’m not using comments, I am very sorry, but I hate comments as they usually just distract me, look messy and are unnecessary if you use descriptive naming conventions.</em></p><p>Although this is a fairly basic script, here is a quick run down of what is happening and why we would use it. As the name suggests, this is for mocking the position and vertical rotation of the MobileDevice in the editor. As shown in the code, the up arrow key and the down arrow key move the transform this script is attached to forward and backwards respectively. The left and right arrow keys rotate the transform clockwise and counterclockwise respectively.</p><p>Open the MobileDeviceLocationFollower and paste the following code:</p><pre>using System.Collections;<br>using System.Globalization;<br>using UnityEngine;<br>using Google.Maps;<br>using Google.Maps.Coord;</pre><pre>#if UNITY_ANDROID<br>using UnityEngine.Android;<br>#endif</pre><pre>namespace TestApp.MobileDevice<br>{<br>    public class MobileDeviceLocationFollower : MonoBehaviour<br>    {<br>        [SerializeField] private MapsService _mapsService;<br>        [SerializeField] private LatLng _latLng;</pre><pre>        private bool _isPaused = false;</pre><pre>        private Vector3 _pausedPosition;<br>        private Vector3 _north;</pre><pre>        private void Start()<br>        {<br>            GetPermissions();<br>            StartCoroutine(Follow());<br>        }<br>      <br>        private IEnumerator Follow()<br>        {<br>        #if UNITY_IOS<br>            Input.location.Start();<br>        #endif</pre><pre>        #if UNITY_EDITOR<br>            gameObject.AddComponent&lt;MobileDeviceEditorController&gt;();<br>            Debug.Log( &quot;Mocking location in editor. Origin starting at MapService Location from Map Preview Options&quot; );<br>        #else<br>            while (!Input.location.isEnabledByUser)<br>            {<br>                Debug.Log(&quot;Location services not enabled..&quot;);<br>                yield return new WaitForSeconds(1f);<br>            }<br>            Debug.Log(&quot;Location services enabled.&quot;);<br>        #endif</pre><pre>        #if !UNITY_IOS<br>            Input.location.Start();<br>        #endif</pre><pre>        #if !UNITY_EDITOR<br>            Input.compass.enabled = true;</pre><pre>while (true) <br>            {<br>                if (Input.location.status == LocationServiceStatus.Initializing)<br>                {<br>                    yield return new WaitForSeconds(1f);<br>                }<br>                else if (Input.location.status == LocationServiceStatus.Failed)<br>                {<br>                    Debug.LogError(&quot;Location Services failed to start.&quot;);<br>                    yield break;<br>                }<br>                else if (Input.location.status == LocationServiceStatus.Running)<br>                {<br>                    break;<br>                }<br>            }<br>            _latLng = new LatLng(Input.location.lastData.latitude, Input.location.lastData.longitude);<br>        #endif</pre><pre>            yield return new WaitWhile(() =&gt; _mapsService == null);</pre><pre>            _mapsService.Events.MapEvents.Loaded.AddListener(OnMapLoaded);<br>            <br>            _mapsService.InitFloatingOrigin(_latLng);<br>            _mapsService.LoadMap(<br>                new Bounds(Vector3.zero, new Vector3(1000, 1, 1000)),<br>                Google.Maps.Examples.Shared.ExampleDefaults.DefaultGameObjectOptions</pre><pre>            );<br>        }<br>        <br>        private void OnMapLoaded(Google.Maps.Event.MapLoadedArgs _args)<br>        {<br>            LatLng _ll = GetLatLng();<br>            LatLng _ll2 = new LatLng( _ll.Lat + 0.0005, _ll.Lng );<br>            _north = GetPosition(_ll2) - GetPosition(_ll);<br>            CheckIfAtWorldOrigin();</pre><pre>        #if !UNITY_EDITOR<br>            StartCoroutine(UpdateDevice());<br>        #endif<br>        }</pre><pre>        private IEnumerator UpdateDevice()<br>        {<br>            while(true)<br>            {<br>                Vector3 _newForward = Quaternion.AngleAxis(Input.compass.trueHeading, Vector3.up) * _north;<br>                transform.rotation = Quaternion.LookRotation(_newForward, Vector3.up);<br>                transform.position = Position();</pre><pre>                yield return new WaitForEndOfFrame();<br>            }<br>        }</pre><pre>        private void CheckIfAtWorldOrigin()<br>        {<br>            if( DistanceFromOther(new LatLng(0.0, 0.0)) &gt; 5 )<br>            {<br>                //The user does not have location settings on.<br>                //This could mean that the location permission is<br>                //granted to the app, but the general location services is off.<br>                //What should we do??<br>            }<br>        }</pre><pre>        public float DistanceFromOther(LatLng _latLong)<br>        {<br>            return Vector3.Distance(<br>                GetPosition(_latLong),<br>                Position()<br>            );<br>        }</pre><pre>        public float DistanceFromOther(string _latLongStr)<br>        {<br>            string[] _latLongArr = _latLongStr.Split(&#39;,&#39;);<br>            return DistanceFromOther(<br>                new LatLng(<br>                    double.Parse(_latLongArr[0].Trim(), new CultureInfo(&quot;en-US&quot;)),<br>                    double.Parse(_latLongArr[1].Trim(), new CultureInfo(&quot;en-US&quot;))<br>                )<br>            );<br>        }</pre><pre>        public LatLng GetLatLng()<br>        {<br>            LatLng _latLng;</pre><pre>        #if UNITY_EDITOR<br>            _latLng = _mapsService.Projection.FromVector3ToLatLng(transform.position);<br>        #else<br>            _latLng = new LatLng(<br>                Input.location.lastData.latitude,<br>                Input.location.lastData.longitude<br>            );<br>        #endif<br>            return _latLng;<br>        }</pre><pre>        private Vector3 GetPosition(LatLng _latLng)<br>        {<br>            return _mapsService.Projection.FromLatLngToVector3(_latLng);<br>        }</pre><pre>        public Vector3 Position()<br>        {<br>            return GetPosition(GetLatLng());<br>        }</pre><pre>        private void OnApplicationPause( bool _pauseStatus )<br>        {<br>            if( !_isPaused &amp;&amp; _pauseStatus )<br>            {<br>                _isPaused = true;<br>                _pausedPosition = transform.localPosition;<br>            }<br>            else if( _isPaused &amp;&amp; !_pauseStatus )<br>            {<br>                StartCoroutine( CheckLocationVarianceDuringPause() );<br>                _isPaused = false;<br>            }<br>        }</pre><pre>        private IEnumerator CheckLocationVarianceDuringPause()<br>        {<br>            yield return null;</pre><pre>            if( Vector3.Distance( _pausedPosition, Position() ) &gt; 10 )<br>            {<br>                //The GPS offset is more than 10 meters from the paused position,<br>                //this likely happened because the user paused and came back after<br>                //moving the said distance<br>            }<br>        }</pre><pre>        private void GetPermissions()<br>        {<br>        #if UNITY_ANDROID<br>            if(!Permission.HasUserAuthorizedPermission(Permission.FineLocation))<br>                Permission.RequestUserPermission(Permission.FineLocation);<br>        #endif<br>        }<br>    }<br>}</pre><p><em>Ok, you got me, I’m using comments, but just to show where temporary code should go and to give an explanation about what is going on in some cases because the script is a bit longer.</em></p><p>The MobileDeviceLocationFollower class above is used get the users device location and translate it into a Vector3 position in our game world in Unity. I’ve added a few helper functions inside the class which are helpful for most use cases. Here is a rundown of how the class works:</p><ul><li>In the Start() method we call GetPermissions(); which tests to see if the user has location services enabled for the app and if the location services are not enabled, we request for the user to allow the app to access their location. This is just valid for Android devices since iOS automatically asks the user for us if the location services are not enabled when we call Input.location.Start();</li><li>After getting permission from Android users, we start the Follow() coroutine where we immediately call Input.location.Start(); if our user has an iOS device to make sure we get the permission we need before continuing and also to startup the GPS on iOS.</li><li>If we are working in the Unity Editor then we add the MobileDeviceEditorController gameObject.AddComponent&lt;MobileDeviceEditorController&gt;(); , otherwise, we wait until location services have been enabled.</li><li>Now we startup the GPS on Android and then we enable the compass so we know which way the device is heading Input.compass.enabled = true;</li><li>We then wait for GPS to start running if(Input.location.status == LocationServiceStatus.Running) or for it to fail if(Input.location.status == LocationServiceStatus.Failed) , but let’s try to be positive here.</li><li>Depending on what you have going on in your scene, the Maps Service can be null, so we wait until it isn’t null yield return new WaitWhile(() =&gt; _mapsService == null); before we add a listener to the map loaded event _mapsService.Events.MapEvents.Loaded.AddListener(OnMapLoaded);</li><li>The InitFloatingOrigin call, _mapsService.InitFloatingOrigin(_latLng); , tells Maps Service to initiate from a particular latitude/longitude real world position and the origin of the game world in Unity will take on this position. I set mine to Sagrada Familia in Barcelona, Spain in the inspector 41.404209, 2.175686.</li><li>The LoadMap call, _mapsService.LoadMap() , is self explanatory. I just passed the bounds as new Bounds(Vector3.zero, new Vector3(1000, 1, 1000)) so we have 1km * 1km of map and then I passed the DefaultGameObjectOptions of the SDK, Google.Maps.Examples.Shared.ExampleDefaults.DefaultGameObjectOptions to get some ready made styles in the scene.</li><li>When OnMapLoaded() finally gets called, we get our current latitude/longitude and then we get the north direction as a Vector3. We then call CheckIfAtWorldOrigin() ( this checks against the real world origin ). Finally, we start the UpdateDevice() coroutine if we are not in the Unity Editor.</li><li>The UpdateDevice() coroutine just keeps updating the MobileDevice game object position and rotation to match that of the device in the real world until the scene is unloaded.</li><li>The CheckIfAtWorldOrigin() method is a helper script that I included because the real world origin is off the west coast of Africa in the middle of the Atlantic ocean and it is highly unlikely that your user is there. If the user is registering world origin coordinates, it means that, although they may have the location services enabled for the app, the global location service settings for the phone my be off. You can decide what to do in this case.</li><li>The DistanceFromOther() methods are helpers for getting the distance as a float from the LatLong/string passed in as a parameter to the current LatLong of the MobileDevice.</li><li>The GetLatLng() method is self explanatory. It gets the LatLng of the user device unless we are in the Unity Editor, in which case it get it from converting the Vector3 position into a LatLng.</li><li>GetPosition() and Position() both return the Vector3 position of the MobileDevice.</li><li>We include OnApplicationPause() in the script so as to know how far the user has travelled while the game was paused, which can be helpful in some use cases where we need to adjust things depending on the game state prior to pausing the game.</li><li>Finally we have CheckLocationVarianceDuringPause() which allows us to act if the user moved too much during the pause game for example.</li></ul><p>Now select the MobileDevice in the hierarchy and do the following:</p><ul><li>add a MobileDeviceLocationFollower: Drag the MapManager object into the Maps Service field and add Sagrada Familia’s coordinates (41.404209, 2.175686) in the Lat Lng slot.</li><li>Add a MeshFilter: Set the Mesh target to a “Cube”.</li><li>Add a MeshRenderer: Use the Default-Diffuse material.</li></ul><p>The MobileDevice inspector should now look like the following image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*US56-Vi0dRFreGl1LYQuZw.png" /><figcaption>MobileDevice Inspector</figcaption></figure><p>Now you can make the MainCamera a child of the MobileDevice and position it a short distance behind the MobileDevice and cross your fingers while you press play…</p><p>What do you know, it worked!! Or it should have if you were following along attentively. I bet you never thought you would be playing around with a cube in-front of the Sagrada Familia today!! Gaudí would be proud…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*LDhZpVjg3YPrgiRkoNo4bQ.png" /><figcaption>Sagrada Familia and our Cube</figcaption></figure><p>In the next tutorial of this guide, I will walk through how to customize map styles and modify the Map Features when the respective Maps Service events are fired.</p><p>Ready to head over to the next tutorial? <a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-3-fb2a7927e8b8">Part3: Map Customization</a></p><p>I hope you found this tutorial helpful. Feel free to leave feedback in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cff0d7225300" width="1" height="1" alt=""><hr><p><a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-2-cff0d7225300">A Guide to Using Google’s New Maps SDK for Unity 3D -  Part 2</a> was originally published in <a href="https://medium.com/everdevs-community">Everdevs Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide to Using Google’s New Maps SDK for Unity 3D]]></title>
            <link>https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-ed1d68b2305e?source=rss-665c50d52cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed1d68b2305e</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[google-maps]]></category>
            <dc:creator><![CDATA[Kristopher C. Tobiasson]]></dc:creator>
            <pubDate>Mon, 19 Apr 2021 05:30:22 GMT</pubDate>
            <atom:updated>2023-06-10T08:11:02.282Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Guide to Using Google’s Maps SDK for Unity 3D - Part 1</h3><h4>Part 1: Project Setup</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eV_il0EKT0H88XnHmnCjbg.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/dapple-designers-7874104/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=3120436">digital designer</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=3120436">Pixabay</a></figcaption></figure><p><em>Note: The Maps Sdk from Google is now deprecated. Some readers have inquired about google’s pricing of the gaming API’s. Don’t take my word for it because I don’t work for Google, but as of this writing, Google gives you $200 free credit every month and that equates to having roughly 20,000 daily active users (DAUs) per month. Afterwards, you are charged $10 per 1000 DAUs / month up to 1,500,000 DAUs, thereafter it drops down to $8 per 1000 DAUs / month and there is a note to contact sales for volume pricing when you get to 7,500,001+ DAUs. I recommend that you take a look </em><a href="https://cloud.google.com/maps-platform/pricing/sheet/"><em>here</em></a><em> for a thorough explanation on the pricing, the gaming section is at the bottom of the page.</em></p><p>Over the past year I’ve been developing a real world running game with Unity 3D for Android and iOS. Needless to say, location based game development and I became as thick as thieves in the process, testing each other every step of the way, right up to our recent release.</p><p>Although the initial idea was to use Google Maps, their Maps SDK was not released to the masses until about 4 months after we started development. By that time, I was knee deep in another popular mapping tool from a company named Mapbox and there was no going back at least not until after the first release of the game.</p><p>The Mapbox SDK stuck around with us until the release of version 2.0.0. Thereafter, we decided to do some tests to see what the newly released Maps SDK from the Google Maps Platform was made of. After some thorough test runs, I realized that Google’s Maps SDK was far more suitable for our project.</p><p><strong><em>Time for a boat load of refactoring to be done! </em>😅</strong></p><p>The Maps SDK from Google is brilliant. After taking some time to get familiar with it, you will see just how powerful it can be. Getting setup and understanding the basics is really the biggest hurdle in the way.</p><p>I scavenged the internet in search of some kind of a step-by-step guide which would help with the initial learning curve of using the SDK. It became apparent that since the SDK was so new there was really no such guide available. Ultimately that is what pushed me to create this guide. I hope you find it helpful.</p><p><strong><em>Enough backstory, let’s get to it!!</em></strong></p><h4><strong>Create a New Project in Unity:</strong></h4><p>Before creating your Unity project, I recommend getting the latest LTS release of Unity which is version 2020.3.4f1 at the moment. If you prefer to use an existing project on a previous version of Unity or you have some other reason why you don’t want to use the latest LTS release, then just know that the Maps SDK requires that, at the very least, you are running version 2018.4 of Unity as of this writing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-A8unkKmYiheLgApP7hTvw.png" /><figcaption>Download latest LTS version of Unity</figcaption></figure><p>Once you’ve chosen the version you will be using, create a new project with the regular 3D template and call it whatever you like.</p><h4>Create a new Google Project and get an API Key:</h4><p>Now we can pop over to the Google Developer Console and create a new project so as to grab ourselves an API Key ( Google won’t serve any map data if you don’t supply an API key setup with the correct API ). You will need a google account before you can create a project in the console and a personal Gmail account will work just fine.</p><p>Login to your google account and then head to your <a href="https://console.cloud.google.com/home/dashboard">Google Developer Console dashboard</a>. If this is your first time in the console, you should be shown the following popup with this meet and greet which prompts you to input your Country and to agree to the Terms of Service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*DzBAoYn9FD5LBWgN6ulYMw.png" /><figcaption>Add Country and agree to terms</figcaption></figure><p>After you have agreed you should be in your dashboard which has a blue navigation bar at the top. On that navigation bar, click “Select a project”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*xw8tP5J-w3qLzhIAopiAoA.png" /><figcaption>Select a project</figcaption></figure><p>The following popup should be displayed. Click “NEW PROJECT” and give it any name you want. Don’t worry about the “No organization”, it is just because Google thinks you’re very disorganized… Ok ok, this is just if you have one or more organizations and you can set the project to be a part of one of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*rKA31uaNth2yspwCxDd0gA.png" /><figcaption>Create a new project</figcaption></figure><p>If you’re new to the Google Developer Console or you haven’t already activated your free trial, now might be a good time to do so. There should be a bar at the top of the screen which looks like the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*yLSkwytd0JBu2_trPxbkOA.png" /><figcaption>Who doesn’t want free credit</figcaption></figure><p>So now let’s click on the little hamburger menu expansion button in the top left corner and scroll way down to the “Google Maps Platform”and in the sub menu, select APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*Kipft7sOL8Xey1Am_Z0Ktw.png" /><figcaption>Check out available API’s in the Google Maps Platform</figcaption></figure><p>There should be quite a few APIs on the screen, but the one we’re looking for has never been present during my visits. Go to the search bar above and type “Semantic tile API”. And click on the API in the search result below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*H2LXUe4vOA3R0IJxOGDMZQ.png" /><figcaption>Semantic Tile API</figcaption></figure><p>On the next page, click “ENABLE” to enable the API. Thereafter, you should see a message which declares that you may need credentials to use the API. Click “CREATE CREDENTIALS”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*i5atJBX0x38E6yA-x3lDFw.png" /><figcaption>Create your credentials</figcaption></figure><p>On the next step, select the “Semantic Tile API” and “Public data”. Click “NEXT”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*a7VWdbV-I-b2nrkA4-OARQ.png" /><figcaption>Select the API for the credentials</figcaption></figure><p>Now an API Key will be generated. Copy the key down somewhere as we will need to use it in Unity shortly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*-EnRT_evx3NWGt5oB-ivxQ.png" /><figcaption>Copy your API Key</figcaption></figure><p>It isn’t one of those keys that you only have one chance to save because you can always come back to your account to get it. Having said that, you should still keep it safe and private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*Cmh6QO6ZCJPtYy4Yhf667Q.png" /><figcaption>Semantic Tile API Key</figcaption></figure><p>As the warning suggests, before using the key in production, it is recommended to restrict access to the key. This is so no other apps can use your key to extract Semantic Tile API data which will cost you money!! Restricting the API key is out of the scope of this tutorial as we are not going to use the key in production, but keep it in mind before launching any app which makes use of your API key as it is an important security measure to implement.</p><h4>Get the Maps SDK and Test it Out:</h4><p>Let’s go ahead and <a href="https://developers.google.com/maps/documentation/gaming/install_sdk">install the Maps SDK</a> and unzip it’s archive file. If you’re using a version of Unity which is between releases 2018.4 and 2019, then you would choose the 2018 download link, if you’re using a version which is 2019+, then you should choose the 2019 download link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*3_9ND0LMBZ_DsXa8h_uPkw.png" /><figcaption>Download the respective SDK</figcaption></figure><p>If you don’t have the Unity project open, open it up and at the top of the screen select Assets/Import Package/Custom Package… Find the Maps SDK package folder and import both the examples package and the Maps SDK package into the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*iU9LFg-rqPkUtPcWwqFmnQ.png" /><figcaption>Import package</figcaption></figure><p>In the project panel, go to Assets/Examples/01_GettingStarted and open up the “HelloWorld” scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*Bbi7KeHzxNGPov9vzDlWWw.png" /><figcaption>Open HelloWorld scene</figcaption></figure><p>In the scene’s Hierarchy panel, select the “Basic Example Script” game object and add your API Key from Google to the API Key field highlighted in red.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*jDLiQioqlxcJcvtjchb_Xw.png" /><figcaption>Include your Semantic Tile API key</figcaption></figure><p>Now press play and you should see the Statue of Liberty. Move around with WASD, QE and the arrow keys and check out different GPS coordinates by changing the Lat Lng field in the “Basic Example” script. Furthermore, if you dig a bit through the Google Maps Example folder, you will find a lot of scenes, each showing off a different aspect of the SDK. Just make sure to paste your API key in the Maps Service script in any scene you open up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*CgtkyUBm_QGr4NkZM6670Q.png" /><figcaption>Apparently she stands for liberty</figcaption></figure><p>Well that’s a major step out of the way. Although we haven’t taken a dive into the actual functionality of the SDK, we can now dynamically load the surroundings of any GPS coordinate in the world. That’s pretty cool!</p><p>We’ll get our hands dirty in the next one with our own custom map scene.</p><p>Ready to head over to the next tutorial? <a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-part-2-cff0d7225300">Part 2: Map Scene Setup</a></p><p>I hope you’ve found this tutorial useful. Feel free to leave feedback in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed1d68b2305e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/everdevs-community/a-guide-to-using-googles-new-maps-sdk-for-unity-3d-ed1d68b2305e">A Guide to Using Google’s New Maps SDK for Unity 3D</a> was originally published in <a href="https://medium.com/everdevs-community">Everdevs Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>