7 days of WordPress plugins, themes & templates - for free!* Unlimited asset downloads! Start 7-Day Free Trial

Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.5 Try it Out on a Device

Finally! You now get to see what you have been working towards. In this lesson, I will show you a minor change that you may need to make to the Xcode project. Then you'll be ready to get your precious app deployed to a physical device and really start to have some fun with it.

2.5 Try it Out on a Device

So the final piece of the puzzle is to take our project that we exported from Unity and brought into an Xcode project is now to build and deploy this on a physical device so that we can actually see it in action. Now, the reason we need a physical device for this is because this application is going to make use of the device's camera in order to project this augmented reality. This 3D object. This cake on a plate. And because of that, like I said, you need a physical device. So in my example here, I am going to plug in an iPhone to my laptop so that I can get access to it so that I can ultimately build and deploy it on to that device. Now, when you start to look at the Xcode project here, one thing you're going to notice that you're probably going to see if you try to build and run this initially is is that the bundle identifier that comes with it is very generic. And it's gonna say something like product name and company name or something like that. It's gonna be very generic. And odds are, if you try to run and build that, it's not gonna work. It might complain at you. So in order to get around that you need to select your Unity-iPhone target here. And then you can come into the bundle identifier and give it a name. Now, if you're not familiar with how this works it's kind of like reverse DNS notation, where we have com.something.something. So in my case, I just changed it to be com.DerekJensen.TutsARDemo, but you can change it to be anything that you want as long as it is unique. Now, from this point, you wanna come up to the top here where it says Unity iPhone, or whatever it says for your particular case. And you wanna select iPhone here and you wanna make sure that it says, a physical device here. So under Device, it says iPhone here. You want to make sure that that is selected, because that is the physical device that's connected to my laptop at this point. So once it has done that, I can go ahead and select the run button. And it's going to build my project, it's going to compile all the source code, and then it is going to deploy it to my physical device. Now, once it has finished deploying to the physical device, you can now see exactly what is going on within my application here. So right now, you see kind of a closeup of my table. And I'm gonna start to very slowly bring into view a cake plate or a sample plate that I ultimately took my target or marker image from. And as you can see, I'm not quite there yet, but as soon as I bring it fully into view, now my image is going to show up on there. So now there's my augmented reality piece of cake sitting on top of the plate. Now, one thing to notice is if that image, which was that happy birthday image that we used as a target, if for some reason it becomes blurry or too far away or it's not fully recognizable, your image will disappear. So as you see, I turned my cake plate a little sideways, so it didn't show up. But now if I turn it back down, it's fully within view again, and now it will work. And I can rotate this around. And you can see where the shadows from the candles are showing up here. And that has to do with the directional white that we placed on the Unity scene. And it's showing up there very nicely. So there you have it, now you can see how you can create a nice little augmented reality image in a very similar way that you would see maybe a Pokemon image in Pokemon Go through your device on an application built using Unity and Vuforia.

Back to the top