iOS Game Development Via Unity: A Guide For Beginners!
Some popular games on the iOS platform like Forgotten Anne, Alto’s Adventures, Hitman Sniper, etc were built using the Unity game engine platform. The ease of building games through the Unity for iOS platform will grow in the future as well. Follow the blog to grasp some of the essential steps for iOS game development in the Unity platform.
Steps for iOS Game Development in the Unity Platform:
For Best Results:
An Apple Developer Account must be set up by the developer. This is to utilize the Unity game engine’s platform’s ability to the fullest. From establishing your provisional profiles to adding devices, many functions are performed through Apple’s Developer Website. When we actually build the project, the developer needs to create the game and build in Xcode as well.
Make these changes:
- Under the Unity Hub, select the Installs button and choose the appropriate version of the Unity game engine.
- Click the three little dots available to the right and choose – Add component.
- Select iOS build support if the game is to be created in an iOS operating system.
- Click on Next. It contains SDK as well as NDK tools which are needed to create a complete game on the iOS platform.
- Click Done and wait for the installation.
- Come back to the window containing Projects, Learn, and Installs.
- To the right side, choose New in order to create a new Unity project. Enter the Project Name, Unity Version, and Template.
- Choose -Create Project- and get inside the Editor.
Working with Unity Editor:
- Once inside the Unity Editor platform, convert it to iOS.
- Go to the Files in the left corner on top of the screen.
- Choose Build Settings and from that window, choose the iOS platform by scrolling down.
- Click on the Switch Platform after selection.
Preparing Unity Editor:
- This includes steps like adding folders, different aspect ratios, importing some assets, and setting up a scene to go over touch inputs and gestures required for the new game project.
- Choose three new Folders by right-clicking from the Assets under the Unity Editor. Name the folder as Materials, Scripts, and Prefabs.
- Particle effects can be added to the Prefabs folder later.
- Try to drag a bunch of different 3D model assets to experiment with later on.
Creating 3D Objects:
- Set up a basic scene in the Scene section of the Unity Editor.
- After that right-click to choose 3D objects and choose a shape.
- Upon choosing a shape, for instance, a Cube, its parameters will appear on the right side under the Inspector tab.
- Make changes based on your requirements by choosing from under Transform, Mesh Render, and Box Collider.
- Click on Add component once the shape is chosen.
- To the right of the Inspector Tab, Lighting Tab can be found.
- This will help enhance the color of the component created by changing the Environment, Lightmapping Setting, Mixed Lighting, and Realtime Lighting.
- Or click on Auto-generate at the bottom for ease and then choose Generate Lighting.
- Under the Assets, create a new material by choosing it from the Materials folder.
- For instance, if Ground is the material you want to create, you can change the composition based on color and other settings.
- Try to cross-check the created assets and materials in the Game view to find out whether your expectations have been met or not.
- Choose the view based on changes in the Camera component of the Inspector tab to the right.
Adjusting Aspect Ratio:
- One can change the aspect ratio and resolution for the game is created.
- This is to make sure that the game objects, materials, and other assets created are visible on all different platforms of Apple devices like iPad and iPhone.
- Choose the Game tab on the Unity Editor and click on Free Aspect to make changes based on your needs.
Addition of Touch Inputs:
- Go to the Scripts folder. Right-click. Make a selection to choose Shades. Create a new C# script based on the requirements of the game.
- For instance, if you want to change the colors of the objects when they are touched, go for the name: Color changer.
- Attach the newly created script to the main camera. Open the new script inside Visual studio.
- Add the function which you need.
You can write codes for more complicated color and touch schemes inside the Visual Studio. Zoom gestures, Drag gestures, etc can also be added to the game based on a similar procedure.
This will enable the building of mobile inside Unity for iOS devices.
- From the Unity Editor, choose Edit.
- Choose Project setting from the dropdown. In the Project setting window, choose the Player option.
- Enter the Company Name, Product Name. Go down to the Resolution and Presentation option.
- From this, select -Allowed Orientations for Auto Rotation option.
This will decide the orientation we want inside the app for the game: Portrait or Landscape.
The Unique Bundle Identifier:
- Go to the Other Settings.
- Choose Bundle identifier from under Identification.
- It is a unique identifier that all the apps have. The format for that is: com.<company name>.product name.
It doesn’t necessarily need to be a company name for real.
- Go to Build Settings under the File menu. From the build settings window, click on Add Open Scenes to add sample scenes under Scenes In Build.
- Down below, select the Platform as iOS. After these actions, click on the Build option without fail.
- A pop-up asking for information to Save As, Where and Tags will appear.
- Enter the information and click on Save.
This action will begin to build the app.
Working With Xcode:
The next step is to download an app called Xcode available on the app store. It is a compulsory step to build games for iOS platform.
- After downloading, open the folder where you have saved the new game.
- From the folder choose the following: Unity-iPhone.xcodeproj and double-click on the same.
- Make sure that the Bundle Identifier is exactly the same as that of the one in Unity.
- Choose a display name for the game as well.
- From the Xcode menu, choose Preferences.
- Add a new account. This can be performed by clicking on the plus symbol from the bottom left corner of the screen.
- From the pop-up, select the Apple id and click on continue.
Managing Sign In Options:
- Go to the Xcode app window. Choose the Signing dropdown from the General Tab.
- Choose, Automatically Manage Signing option. Click on the Enable Automatic from the resultant pop-up.
- This will fill up all the details for all the options down below.
Building And Launching The Game:
- After that click on the Play button on the top left-hand corner of the screen in the Xcode app window.
- Xcode will then build the game into your device, i.e. the iPhone. The device must be plugged in.
- Once the building process is complete, Xcode will launch the game on the device.
Testing of the App:
You can build as well as test your app in the Xcode. Submit the game to the Apple certification team for review. If your game app clears all the parameters, your game will be live in the App Store in 24 hours.
If you have a bigger game idea, you can approach Juego Studios which has created many viral apps for the iOS platform built in Unity namely Tree World, Pool Game, Adventure Quest Battle Gems, etc.