Setup Android Mobile Port: Unity Tutorial

Jonathan Weinberger
A free video tutorial from Jonathan Weinberger
Authorized Unity Instructor
4.5 instructor rating • 9 courses • 105,805 students

Lecture description

Setup our project for Android mobile game support!

Learn more from the full course

The Ultimate Guide to Game Development with Unity 2019

Created in partnership with Unity Technologies: learn C# by developing 2D & 3D games with this comprehensive guide

21:11:01 of on-demand video • Updated September 2020

  • Master beginner C# concepts, like variables, "if" statements, and arrays
  • Detect collisions, receive user input, and create player movements
  • Create power-ups including triple shots, laser beams, speed boosts, and shields
  • Apply shaders that transform your game backgrounds
  • Create enemies with basic AI behavior
  • Collect and destroy game objects
  • Implement sound effects, background music, and particle effects
  • Activate and use Unity’s Team Collaboration service
  • Navigate the Unity Engine and discover unique features like the Asset Store
  • Deploy your game to over 20 web or mobile platforms
English [Auto] This video we're going to go ahead and set up our game for Android mobile development in order to get started. We're going to be using an asset from the asset store called the Unity standard assets cross platform input controller. This is a cross-platform script that unity created that is going to replace our existing input manager with a cross-platform one that will automatically work for mobile. So in order to do this you have to go to your project if you right click go to import package and select crossplatform input. Now if you don't have these options it means that you don't have the standard assets installed. So what you can do is you can actually hop over to the assett store type in standard assets download them and then you can repeat the steps that I just did. So go ahead and let this import the standard assets cross-platform input controller and we'll continue once it's finished. So once that's finished importing you're going to have a folder called Standard assets. And inside will be a cross-platform input folder and inside this there is a prefabs folder. What I want you to do is I want you to take this mobile singlestick control and just drag it in your higher key and what's going to happen is it's automatically going to bring in Mobile joysticks and mobile buttons. Now we're getting a reference here and the reason for that is because our cross-platform input script is automatically detecting the build type for our game which is right now it's PC in its PC platforms. So in order for these to become active you'll see here that they're not actually on and you actually can't turn them on. And the reason for that is because the cross-platform input script controls when these are active based on if you're on a mobile device. So what we want to do is we need to we need to go to File build settings select Android and select switch platform. Now that's not an option for you. That means that when you install on unity you did not include the Android package. That's not a problem. All you have to do is select like a package that you don't have. So for instance for you it might be Android but if you click it it will say open download page when you select that it's going to. It's going to download a DNG file if you're on a Mac or an XP file if you're on Windows. Go ahead and run that close unity. And when you bring unity back up you should be able to successfully select the android and then hit the switch platform button. Now this is going to take several minutes to complete. So go ahead. Pause the video and I'll see you when it's finished. When that is finished you'll notice that in your game view your mobile single stick controller has automatically enabled itself. And if you actually run your game right now nothing's going to change but you will be able to control this in any direction. And what we're going to be doing now is instead of using the way we're moving our player which is through the input manager using the get access system we're going to swap it out for the cross-platform input to move our player. And when we hit this jump in it's actually going to fire. So before we end this video for the setup. One last thing selector jumped in and let's go and rename that text inside of it to fire. So it says JUMP RIGHT NOW change it to fire. And you're more than welcome to customize this however you want. For the for this tutorial I'm just going to be keeping it as the standard. I'll see you guys in the next video.