Welcome back!
In this video we'll be setting up Build Settings in Unity,
building to the iOS simulator. You'll need a
Mac or at least a Mac emulator, though that's naughty.
To build to a physical device, you
would need, again, possibly a way around it, but you would need a dev
kit, so we're just going to build to the simulator.
Briefly play-test and note any improvements, and then I want you to
share your creation with the world. So, I'm going to
show you how to do it, and then at the end, like the Android video
I'm going to show you, or challenge you rather, how to do it.
So, let's go ahead and go into Glitch Garden. Go to
File and Build Settings and click on
iOS and then Switch Platform.
And the little Unity logo will eventually move across from Android
to iOS. Now, it's reimporting assets
and making sure that they're all compatible with iOS. A notable difference
is that .ogg sound files aren't compatible, so you
may have got an error, at this stage, asking you to change the format
of one of your sound files. If you have then,
for changing graphics files, then I suggest you
look at gimp.org, and you can change from pretty much any format
to any format. And for changing sound files, take a look at
audacity.sourceforge.net
Again, free and available for Mac and PC.
So, assuming that you've got this far and that you have switched
Build Setting over to iOS, converting any assets
that you may need to. We now need to click into the player
settings and start taking a look. So, Company Name,
you can change it if you want, it's not vital. I'm going to put in Embrace
IT, my company name. Product Name, I would give it a name,
Glitch Garden. That makes a lot of sense, so that, that's the
thing that appears under the icon on the iOS.
Now, talking about icons, let's have an icon. We currently
don't have an icon, and we didn't do an icon on the Android
Build. So, let's sort that out now. I'm going to go over to
my Images Folder and import a new asset.
And I've got one ready on my Desktop, but
you can get this same file, either from the course asset,
that's at the beginning of the section, or by going to
glitchthegame.com.
See all details in download links, and then
if you download all sprite sheets here, this large
.zip file, then it's contained within
there. And you can see my file name is npc non-player character
fox_fox_orange, etc. And I'm just going to use that one
as the icon, or I really encourage you to
go and find our own graphics. So,
import into your Images. You can rename it, at this stage,
if you like. I'm going to leave it as it is.
But before you carry on, change it to a Texture
up here in the Inspector. Texture Type, Texture.
Alpha from Transparency, in my case,
so that it has a transparent background, and
make it Truecolor, not compressed.
So, it's type Texture, Alpha Is Transparency,
and then Truecolor, and then Apply that.
Alright, now that is going to be
how you want it setup. If you want, go over to the iPhone
and settings, but I'd leave those all as default. The only one you need to
change is the Default Tab here, to Truecolor, so it's not
compressed. OK fine! So, back into the
Build Settings and Player Settings. Now,
where it says Default Icon, you actually have an icon to
drag right. You have a texture, which is your Fox, and you can drag it
into default icon here, or just select from default
icon. Perfect! We'll leave the cursor as it is. Let's go
through the rest of the options. Default Orientation.
Auto Rotation is fine. Use Animated
Autorotation, that's fine! We want to
un-tick Portrait and Portrait Upside Down. This is not a portrait
format game, so you just want the two landscape options.
So, the only change here, under Resolition and Presentation
for the iOS, is the portraits have been
unticked. Onto icon, you'll see,
very helpfully, Unity has created all the different required icon sizes
for us, from that fox icon. Some of them are
probably bigger than the source icon, in my case, but don't worry.
If you really want it to look sharp, then make sure it's
image is at least as big as 180 by 180.
Splash Image we can't change, but we've done a
workaround. And then, here
very important, again you set up your Bundle Identifier. If you followed the
Android Video, then this will all be set. Otherwise, you need to set com
dot your company name, or just your name. So, this could be com
dot John dot GlitchGarden.
Alright, Target Device. I'm going to go for
iPad only here. I've had a little bit of trouble getting
it to work on iPhone, so I'm going to go iPad only.
And then, let's move down
to SDK Version, under Optimization.
That needs to be set to Simulator SDK.
We're going to be deploying to the Simulator, so it's very important you set it to
Simulator SDK, or you'll get some really strange errors.
Target iOS version 4.3. It's a bit
old isn't it? It's up to you where you go here. I'm going to pick
7, so that it'll work on the last couple of generations.
So, that's fine! Now, let's build and run!
It'll ask us where we want to save the iOS Build
to. I'm just going to save it in my Downloads,
and it's an iPad only build. So, it's
GG iOS build, iPad only.
Now, while it compiles that, you may wonder why you want to save this
file, because this building process can take hours on a big project,
and if you want to deploy it across multiple devices or share it with a friend,
then you're going to want to have the Xcode File.
Before we worry about what happens over in
Xcode, let me talk about two different things. Firstly, what has it just created?
If we look into it, this
GG iOS Build - iPad only, it's actually made an
Xcode Project for us and all the subfolder we need.
So, that's what it's created, and from Xcode we can deploy.
Secondly, do you have Xcode running? Is it working
properly? If not, then just simply go to
developer... Just type Xcode into Google, and you'll get to the
Apple Developer Xcode page, and under download you'll
see that the downloading and updating of Xcode is all
managed through the Mac app store.
It'll open your Mac app store, like this, and in my case already, I have Xcode.
I'm using Xcode 6.2, I
think. Let's have a look, 6.1.1. There you
go. Cool! So, once you're over here in Xcode,
go to the Xcode menu, and then, Open Developer
Tool and iOS Simulator.
And that will open up the iOS Simulator, like this. Now, I'm
going to leave mine on the iPad Air. You can choose your device here.
Device, Hardware... Sorry,
Hardware, Device, and then, Manage Devices, and you can put other
devices in, if you want, with this little + symbol at the bottom.
So, I'm actually going to remove... I'll leave it as it is.
As long as I've got an iPad Air there, that's fine.
OK, so the other thing you may need to do is
zoom, because this isn't fitting on my screen. So, I'm going to scale this
to 50%. Actually, it already is scaled to 50%
so I think it's going to be OK, once we get
into Landscape Mode, but Portrait won't fit on my screen, even at
the 50% resolution. So, the simulator is working.
This is a simulated iPad working just fine here.
The Hardware Menu gives you access to like the Home Button.
Cool! So, let's try it! Over back in Xcode, you should
just be able to play. You see, it's got Unity-iPhone, deploying to
iPad Air in the simulator. That's what that things at the top says.
It's at the top left here. Try clicking Play and see what we get.
You are going to get a load of
warnings here. One of them may be that it wants to change the
settings. Just ignore it all for now, see if it runs. There's the Unity Splash
screen. It has a very loud sound,
and there's Glitch Garden. There comes our fade in.
We can change the sound volume.
Perfect! And then, play the game!
Pretty awesome hey!
Now, it is actually fitting on the iPad screen. Remember how we planned this to fit
on the iPad. It's working exactly like we thought,
but one thing we do notice, if you hit the Home Button by going
Hardware and Home, it comes home. There's your
icon! OK, it looks a bit funny, but let's not obsess about the icon
this time! We'll get more into icons next time we deploy
to mobile, but if you click back into it look, you can only come back
here. How could we quit the game? We can't!
So, the Quit Button works, but not
in the middle of the game play. We have no way of pausing,
so I'm capturing myself now a to do for
Glitch Garden, which is to include some sort of simple Pause Menu.
Otherwise, the player can't pause the game
or get out of it even, without...
The only way they could restart the game
completely, is to either die for to use the multitasking
system, on the iPad, to close the app by swiping,
which is pretty inconvenient. But that's basically it!
We've got the deployment working. What I want you to do now is do it for yourself!
Deploy to iOS and share. Get it running
on your iOS Simulator or on your device, if you have a Dev Kit.
Excitedly show somebody, anybody, your wife, your dog, your
cat, somebody on the street! Capture a screenshot
of what you've done on iOS, and then, share in the
discussions or Facebook group and maybe
invite your friends into the Facebook group and see what they think your non-
Unity course friends. So, good luck deploying to iOS
and I will see you soon!