Unity Iphone Newbie Guide - Lesson1
Unity Iphone Newbie Guide - Lesson1
IPhone
Lesson 1: Getting Started
Gregory Pierce
May 16, 2009
Step 1: Start the Unity iPhone environment. The icon for Unity
iPhone looks somewhat similar to that of Unity except for the iPhone
sitting next to it. You should have installed Unity first before
installing Unity iPhone (because the Unity environment will remove
or replace some demos if you do it in the other order). If you installed
them in a different order, you can simply reinstall Unity iPhone and
get back all of the demos that you may be missing. Once you have
done that you will have the Unity IDE as shown above. Note that you
can NOT develop Unity iPhone applications in the ‘regular’ Unity
Indie/Pro IDEs - they are not capable of producing iPhone
applications.
Step 2:
The next thing we
need to do is to create
a Unity Project. A
Unity Project contains
all the scripts,
resources, assets, etc.
that will be used in the
game and deployed to
the device. If you have
assets and they aren’t
a part of the project,
Unity will not deploy
them to the target device (it can’t read minds as much as we’d like it
to).
Step 3:
Step 4:
The project Wizard will appear and ask
you for the location of your new project.
Give it a location on disk where you’d like
the project files to be stored. Note that in
this case a directory (Lesson1) will be
created and the project will be stored here.
This is the root directory for the project.
Step 5:
Unity Applications require
some credentials be created
on the Apple Developer
portal. I am assuming that
you already have a certificate
on the developer site. If you
don’t, Apple has a handy
video under Portal Resources
that will help you get your
certificate created and
Step 6:
The Next step is
to create an
Application ID
specifically for
your Unity iPhone
application. To do
this properly it
should NOT be an
application ID
that is a wildcard
ID (i.e. it should
NOT end with a
*). There are a
number of non-
Unity reasons to
not do this
(including Store
Kit as well as
Notifications) so
just take it as law
that you want a
new application
ID for each one of your Unity applications
(well, you won’t have a choice anyway). In this example I create one
for an application called unitylessons - which is the application we
will be building throughout this series. Note the App ID
(com.sojournermobile.lessons) is not a wildcard ID.
Step 9:
Plug your iPhone/iPod
Touch into your
development machine
(important step). Start
XCode. Next, go to the
Window menu and start an
application called the
Organizer. The screenshot
you see here is from the
iPhone SDK 3.0 software.
Your version may look
different if you are running
an older version. Now you
can either double click on
the mobile provision file,
drag it into the organizer,
or click on the plus next to
provisioning and find the mobileprovision file on the
file system. Utilizing any of these approaches should result in your
Step 10:
To confirm that you
have your profile
installed properly, you
can click on
Provisioning Profiles
(note this is SDK3) and
you should see it and
any other profiles that
are installed as well as
any warnings that would
denote an improperly
installed certificate or
similar. If you have ANY
warnings here, read
them and remedy them
as your build will NOT work. Your screen should be as warning free as
mine is here.
Step 11:
We’re almost done. Go back into
Unity and tell it to build and run
your project (Command-B or Apple-
B depending on how dated you are).
You will get a very interesting error
about the iPhoneBundleIdentifier.
Step 11:
The very first setting is the iPhone
Bundle Identifier that the IDE is
complaining about. Note that if
something changes with Unity where
this isn’t surfaced, you can find the
player settings in Edit>Project
Settings>Player. So just click on the
text where the old bundle identifier
is, type in the new one
“com.sojournermobile.lessons”.
Step 13:
Its probably the
humor of the universe
that this step is step
13. If you’ve done
anything wrong - this
is where you’ll pay the
price. Some reminders
before we move on -
Unity is expecting to
deploy to a device,
make sure its plugged
This is the most joyous thing you will see as it means that your app is
fine and its on its way to the phone. One final note is that if you have
some autolock on your phone, XCode may be able to build your app
but not install it. When building, make sure that the device is
accessible.