Sunday, February 2, 2014

Connecting Android Devices to Unity for Game Development



Developing Android games in Unity is incredibly simple and well done in Unity, however getting your phone to sync to Unity is not all that easy. It took me days to figure out how to get them connected properly. Here is every single step that you need to take to get your environment set up to develop Android Unity Games and notes to help you deal with any of the problems that you might have along the way.

It seemed like everything that could have gone wrong went wrong when I was trying to get this installed, so I hope that this helps you to get it done faster than I did.


Step 1: Download the Android SDK



  1. Press the big blue button
  2. Unzip the folder
  3. Rename the unzipped folder ‘Android
  4. Move the folder to C:\
  5. Open the folder and click on ‘SDK Manager.exe
  6. Check:
    1. Tools
      1. Android SDK Tools*
      2. Android SDK Platform-tools*
    2. Android 4.4.2 (API 19), or whatever the latest build is
    3. Extras
      1. Android Support Library*
      2. Google USB Driver*
      3. Google Web Driver*
  7. Click ‘Install x Packages


* These are the only things that you need to install, but you can just install the full Tools and Extra directory for simplicity.


Step 2: Prep Your Phone



  1. Download ‘Unity Remote’ in the Google Play Store.
  2. Go to Developer Options and check off:*
    1. Stay Awake**
    2. USB Debugging **
    3. Allow Mock Locations**
  3. Plug your phone into your computer.
  4. Wait for it to open as a USB device.``
  5. Launch ‘Unity Remote


* In Android Jellybean and higher the developer options are hidden.  You can make them available by going to Settings > About Phone and tapping Build Number until the developer options are unlocked (Yes, you literally tap on it until it unlocks developer settings).  You can also tap on the Android version for a nice easter egg.


** Turn these off when you get done developing.  Otherwise your phone might be vulnerable to getting viruses and the battery will get drained.


`` If your phone doesn’t connect as a USB device then go download your phone’s USB driver from their website.  (ex. I have a Samsung Galaxy S3, so i go to samsung.com and download my driver).


Step 3: Launch Unity



  1. If you don’t have Unity installed then do that now at: http://unity3d.com/unity/download
  2. Create a new project with the ‘standard assets (mobile)’ box checked.
  3. Go to Edit > Preferences… > External Tools and set the ‘Android SDK Location’ to ‘C:\Android\sdk’
  4. Hit play
  5. Look at your phone


Step 4: It still ain't workin'

Close Unity and Unity Remote, unplug your phone, turn all the developer settings off, and do the following steps in the order specified:


  1. Turn your developer settings back on.
  2. Plug your phone into the computer and wait for your computer to notice your phone.
  3. Turn on Unity Remote App.
  4. Launch Unity
  5. Press play

I hope that that worked for everyone. Connecting multiple programs and devices together is incredibly difficult and I probably only encountered half of the possible problems you could have.

Monday, October 14, 2013

Why You Need To Learn Javascript!


You buy stuff online (Amazon).  You socialize online (Facebook).  You get your email online (Gmail).  You store your files online (Dropbox).  I could make a whole article listing out things that people do online on a daily basis, but that's not the point of the article.  Simply put, when you need something you can usually find some web portal that does exactly what you want.

I'm going to assume that anyone taking the time to read this is probably on the internet enough to have seen several of the web applications that I am describing, and if you have been on the internet long enough, then you probably noticed there was a point where web sites stopped being individual pages that loaded every time you interacted with it and became web applications where pages dynamically change as you clicked on links and buttons.  One example of this is when Facebook chat shows up at whatever point someone messages you.  You don't have to refresh the page to see if the chat log changed.  All of those changes are thanks to JavaScript.


What can you do with JavaScript?

  • You can change content on a web page without reloading the web page.
  • You can animate elements on a page, for example:
    • You can make a elements fade in or out.
    • You can move elements around the page.
    • Etc.  (This could be a really long list)
  • You can access the graphics card to make 3D video games and other cool projects in browser like this: Rome - 3 Dreams of Black.
  • You can write multi-threaded code that takes full advantage of all of the processor cores on your computer.
  • You can dynamically send and receive data across the internet in the form of JSON (JavaScript Object Notation) without having to convert it to some language like XML.
  • You can write entire server-side applications using Node.js.
    • If you haven't heard of this and doubt its usefulness, then check out these companies that are using it: Microsoft, Yahoo, LinkedIn, The New York Times, EBay, and Dow Jones.  Those aren't just big names.  Those are huge names.

Why should you learn JavaScript?

  1. Even a totally new and inexperienced JavaScript developer can write useful code easily.
  2. You don't have to learn complicated libraries to build GUIs.  It just connects to web pages.
  3. You don't have to use special complex libraries to handle asynchronous event calls.
  4. It is the only language you can learn that can do everything you need it to (there are exceptions).
  5. It interfaces with most other languages.
  6. Pretty much anything that you need to do with JavaScript you can do for free.  You can download the software for free and you can learn how to use it for free.


Who should learn JavaScript?


Anyone who develops software

If you plan on developing web applications, then you need to know JavaScript (it's your job).  If you don't plan on developing web applications, then (barring some exceptions) you should rethink your team/companies development strategy.  Web applications run on every computer while only having to be written once, unlike Windows programs, Mac programs, or Linux programs.

Anyone who needs to use computers in their work

This group of users doesn't need to master JavaScript, but understanding how code works would allow these people to talk to advanced computer programmers and be able to communicate how to develop apps that they need.  They would also be able to hack something simple together that can easily do part of their job for them.  Code takes a long time to write, but once it's written you don't have to think about it anymore.  It just does what it needs to do.

Students

When I went through school, it was recommended (not mandatory) that we learn to type on a computer.  More and more, though, it is becoming essential that people have the technical ability to work with computers.  There is no computer language other than JavaScript that can be learned on it's own and work at all levels of an application.  Also, it is free!