My First Unity3D App

Wow…so that was exciting.

I just developed and published my first app using Unity 3D. I’ve learned a couple things along the way that might help someone else. For what it’s worth, I monetized with AdMob…not because I think AdMob is the best option (I don’t believe that at all), but because AdMob is a pretty solid mobile ad server. I may use a different solution in the future, but I’m not investing big money until I see how this pans out.

Which reminds me, I’ll also buy a Mac if this pans out. Using a VM was a pain in my ass (the setup went really quick). First, install your Mac OS X virtual machine on an SSD. I guarantee it will make a world of difference. Second, I like to work in big screens. It didn’t help me do that at all. I’m sure there’s a way, but in the last three weeks I’ve learned the basics of Unity 3D, C# (for scripting in Unity), how to basically use XCode (having never done it before). In the event you’re looking to build iOS apps with Unity…you need access to a Mac in some form or fashion. You can’t export iOS code without XCode (and integrating the AdMob SDK requires XCode anyway).

Second, make sure you have your code-signing ducks in a row. In XCode, this means using Apple’s Developer and iTunes Connect sites. There’s a caveat—you’ll need to make sure your account allows for push notifications, even if your app doesn’t push. Whether it was Unity 3D or the AdMob SDK, I’m not 100% sure, but you’ll save a step now (and potentially later) by enabling it (it requires you to generate some keys; Apple does a pretty good job of explaining how). However, Apple doesn’t really tell you how to get your keys, so I’ve included that below. For Android, you have to view the build settings in Unity 3D, create a new keystore (check the box, enter and confirm your password, click “Browse Keystores,” and save the keystore), and then create a new key with Unity (you’ll have the option to do so from the “Alias” drop down). Sign your code before you upload it.

  1. Log into iOS Dev Center
  2. Select “Certificates, Identities, & Profiles” from the “iOS Developer Program” menu on the right-hand side (click here for a screen shot)
  3. Choose “Provisioning Profiles” under the iOS Apps header
  4. Select “App ID’s” under “Identifiers”
  5. Click the “+” at the top
  6. Name the App ID, determine whether you want a specific or wildcard ID, and select the services you want (make sure to select “Push Notifications”)
  7. Confirm the information is correct and submit
  8. You will have to set up SSL certificates to use Push Notifications; Apple will walk you through it
  9. Select “Distribution” under “Provisioning Profiles” in the right-hand navigation
  10. Click the “+” at the top
  11. Select “App Store” under distribution and click “Continue”
  12. Select the App ID you want to create the profile for
  13. Select the associated certificate (may have one or more to select from)
  14. Name and generate the profile
  15. You’ll have to download the profile but everything else is pretty clear-cut

Feel free to post questions here as you have them!

High Treason

I was thinking about the mess with California Senator Leland Yee today, and the way in which things are handled in politics.

Just last year, Representative Nancy Pelosi (D-CA) accused Edward Snowden of treason for leaking NSA secrets. Pelosi is the Minority Leader of the US House of Representatives and was Speaker of the House from 2007 to 2011. Earlier this year, Pelosi called allegations of the CIA spying on the Senate Intelligence Committee “pretty appalling.”

Back up for a second there…

Pelosi claims it’s entirely acceptable for the NSA to spy on everyday Americans, the vast majority of whom are complying with the law.

Yet this week, staunch anti-gun advocate and California State Senator Leland Yee (D-CA) was indicted on weapons charges. He was arraigned on seven charges of corruption and firearms trafficking. Wow, if anyone needed a connection between organized crime and gun control, Yee served it up to them on a platter. This is the same Senator who was so concerned with “legal loopholes” (his wording) that he wanted to ban “bullet buttons.” If you live in a normal state, a bullet button is a device that prevents you from swapping magazines in a semi-automatic rifle or shotgun without a tool (bullets of the respective caliber can often be used as that tool, hence the name). Basically Yee wanted to make nearly every existing semi-automatic rifle in California illegal (maybe he was running out of machine guns to push and figured semi-autos had a better profit margin).

Yee is accused of trafficking in “illegal guns”—meaning full-auto machine guns (constructed after May of 1986 in accordance with federal law; or practically all machine guns in some states, like California). This is the same man who spoke of the dangers of “unregulated guns.”

If the accusations are true, I believe Yee is guilty of treason. He worked to defeat the rights of American citizens while putting incredible firepower on the streets.

Obviously he had no qualms about putting guns in criminals’ hands…nor taking them from everyday citizens. This is how you create an environment of fear and drive people to the “protection” of government.

To NULL or Not to NULL

I’ve found programmers that I’ve worked with lately don’t like my use of null declarations in PHP. I come from a Perl and JavaScript background (with just enough C++ to be dangerous but not particularly useful), so I tend to declare variables before assigning them values (granted, it’s not a requirement in Perl, just a good idea).

If it adds to the complexity (and/or size) of code, why do it?

Yes, it will make the file a little bit larger…but I’ve never seen—or heard of—a minimized PHP file. Minimizing is great for client-side code (primarily JavaScript, HTML, and CSS) but unnecessary when servers handle the workload. You can find discussions of single- vs. double-quotes all over the Internet, even on PHP.net, but declaring variables in PHP seems odd because there’s no requirement to do so (technically, a variable in PHP has a NULL value when declared…but that doesn’t mean you won’t flag a notice).

Why do I [usually] declare NULL?

  1. Clarifying code; by declaring everything before I use it, I know what variables to look for later when I’m debugging (OOP PHP does this out of necessity with class-level variables)
  2. When using an IDE, the software auto-references those variables later; if I don’t have a matching variable, it won’t reflect in the IDE and I can catch typos before they become time-sucking issues
  3. Finally, PHP flags a notice-level error when a variable is referenced that has not been pre-declared; not everyone knows to turn off notice-level errors, and it’s a waste of log space (and effort to dig through logs full of notices)

I highly recommend working with other programmers; I believe it makes us better coders, we learn new ways of doing things and thinking about things. For continuity, you need to agree on programming conventions. I’m not overjoyed about giving up NULL declarations, but all things change—Facebook just released their fork of PHP, Hack.

Dodge Vipers and the Downfall of Society

If you haven’t heard yet, Chrysler Group is demanding a number of early (and even some pre-production) Dodge Vipers crushed. As a longtime fan of this marque (I was 15 when they came out and it is my all-time favorite automobile), I was brokenhearted. Cars get donated to schools and destroyed after their useful lifetimes all the time. Chrysler claims these cars are not historically significant (although I would say any small-batch car is historically significant, especially pre-production ones). Chrysler claims “they felt it was time,” but a little digging shows a couple of these cars got into the wild.

Let’s back up for a second…the donated cars are used to teach students how to work on cars. The reality is technology has come a long way in the last 15-20 years, and the Viper has been one of the few cars that (at least up until the Generation V’s) you could work on from home without complex computer systems. These cars have never been forgiving to drive (stability control is brand new on them in 2013) and somewhere around 20% of all new Vipers end up wrecked. This is the draw of the Viper—as close as you can get to a street-legal race car off the showroom floor.  This isn’t a car for new or under-skilled drivers. Again…this is the draw.

With this knowledge in hand (and recalling that the Vipers loaned to schools were  worked on by students, taken apart and put together over and over again over the years, and were deemed unsafe to drive. That’s probably a fair sentiment, a well-maintained Viper in the hands of an unskilled driver is potentially unsafe (the same could be said for the Corvette ZR1, Lamborghini Aventador, or any other high-powered car). You don’t put that much power into the hands of an unskilled driver. Take a beast of a car like the Dodge Viper, give it 15 years of being worked on and modified by students just to make changes, and the car gets out? What the f*** do you think is going to happen?

We live in an age of lawsuits, and Fiat (via owning Chrysler Group) gets sued when someone gets hurt. I’m not sure at which point Fiat was at fault, it seems to me that the dimwit who took the car for a joyride is the only one to blame. If ignorance of the law is no excuse, than ignoring the common sense of you don’t f***ing drive a car that’s been worked on by students for years should also be no excuse.

Vipers by Generation (semi-official)

Generation I RT-10 1992-1995
Generation II RT-10, GTS, ACR (’99) 1996-2002
Generation III SRT-10: Roadster, Coupe (’06) 2003-2006
Generation IV SRT-10 Roadster & Coupe, ACR 2008-2010
Generation V SRT, GTS, TA (’14) 2013-